Running a command on Windows only if the exe exists

11 views
Skip to first unread message

jmp242

unread,
Mar 16, 2018, 2:05:33 PM3/16/18
to Puppet Users
exec { 'Lenovo System Update':
          command  
=> '"C:\Program Files (x86)\Lenovo\System Update\tvsu.exe" /CM',
          onlyif  
=> 'if exist "C:\Program Files (x86)\Lenovo\System Update\tvsu.exe" exit 0 else exit 1',
          timeout  
=> 10800,
       
}

The problem is apparently that onlyif is failing to exit 1 (i.e. not try and run the command) when the exe doesn't exist. This is testing on Windows 7.

My googling implies the above should work - so before I try something totally different, is it the puppet wrapper that's having an issue? How does everyone else handle spaces in filenames likr this?
Reply all
Reply to author
Forward
0 new messages