How to pass an argument to a Windows Scheduled Task with spaces in it
- by Rodney
I need to set up a Windows Scheduled Task. It accepts 1 parameter/argument which is a path and can contain spaces. My Scheduled task does not work - it "breaks" the parameter up at the first space.
If I run it in the Command Prompt I can just wrap the argument in " " and it works fine, however, this does not work in the Scheduled Task UI.
e.g. C:\Program Files\xyz\FTP File Transfer\FTPFileTransferTask.exe "C:\Program Files\xyz\The Interface\Folder Path"
I have tried wrapping the argument with " " ' ' [ ] () and have tried filling in the spaces with %20, ~1 etc. with no luck.
I know of one solution to make a bat file and use " " around my argument but I don't want to add more complexity.
I tried it on Windows 7 and Windows 2008 Server and both failed. There seems to be no discussions on this?