WinSendKeys uses quotes to group input which includes spaces. As quotes are used in the same way by schtasks, I had hoped to avoid problems by assigning the parameters to be used by schtasks to a variable.
set PRMTRS=/create /xml "X:\task.xml" /ru "COMPUTER_NAME\USER NAME" /tn "Imported Task"
The debug log seems to indicate this did not work:
2012-11-10 04:20:06.131, Debug logging enabled
2012-11-10 04:20:06.136, Executable Filepath specified: schtasks
2012-11-10 04:20:06.140, Executable Parameters specified: /create
2012-11-10 04:20:06.144, exename: schtasks
2012-11-10 04:20:06.148, Window: /xml
2012-11-10 04:20:06.160, Windowhandle: 0
2012-11-10 04:20:06.164, Running executable: schtasks /create
2012-11-10 04:20:06.297, Running executable PID: 4048
2012-11-10 04:20:06.676, Window '' not found.
I tried to group the entire set of parameters to be used by schtasks with quotes.
set PRMTRS="/create /xml "X:\task.xml" /ru "COMPUTER_NAME\USER NAME" /tn "Imported Task""
2012-11-10 04:24:08.292, Debug logging enabled
2012-11-10 04:24:08.297, Executable Filepath specified: schtasks
2012-11-10 04:24:08.301, Executable Parameters specified: /create /xml X:\task.xml
2012-11-10 04:24:08.307, exename: schtasks
2012-11-10 04:24:08.312, Window: /ru COMPUTER
2012-11-10 04:24:08.324, Windowhandle: 0
2012-11-10 04:24:08.329, Running executable: schtasks /create /xml X:\task.xml
2012-11-10 04:24:08.491, Running executable PID: 2204
2012-11-10 04:24:09.270, Window '' not found.
(The above is an approximation of the log, due to anonymization.)
It would seem that the quotes are causing the problem.
Ath, any chance of a quick fix?
A grouping symbol like ¶ (Right Alt + ; ) or × (Right Alt + =) would be less likely to conflict with parameters.