Add parameter to a new Task in Task Schedule with NSIS
hi,
i want to put some parameter for a new Task in Task Scheduler.
if i write so:
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"$0" /C if 1==1 SchTasks /Create /SC ONLOGON /TN "ATask" /TR "C:\PROGRA~2\test\test.exe -j 1 -t 30 min"'
It works.
And if i write so:
Var /Global tempVar
StrCpy $tempVar "C:\PROGRA~2\test\test.exe"
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"$0" /C if 1==1 SchTasks /Create /SC ONLOGON /TN "ATask" /TR "$tempVar -j 1 -t 30 min"'
It also works fine.
But if i write so:
Var /Global tempVar
StrCpy $tempVar $ShortName # $ShortName has this value => "C:\PROGRA~2\test\test.exe"
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"$0" /C if 1==1 SchTasks /Create /SC ONLOGON /TN "ATask" /TR "$tempVar -j 1 -t 30 min"'
But It does NOT work!!!
it only add "ATask" in Task Scheduler without parameter.
How can i put some parameter to "ATask" in NSIS?