How to pass an argument to a Windows Scheduled Task with spaces in it

Posted by Rodney on Super User See other posts from Super User or by Rodney
Published on 2011-04-14T05:24:06Z Indexed on 2013/10/31 22:00 UTC
Read the original article Hit count: 314

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?

© Super User or respective owner

Related posts about Windows

Related posts about scheduled-tasks