15
2
When setting up a scheduled task, for the action section I'm trying to access an environment variable for the location of the executable that I wish to run. This is mainly because on one machine the executable could be in C: on another it could be on D: I've verified that if I use a hard coded path my scheduled task runs, but if I change the action to point to "%MyAppPath%\MyApp.exe"
the task won't start suffering a launch failure. I've verified that the environment variable is set up.
Is it even possible inside the action (and working directory) part of task schedule to reference an environment variable - is my syntax wrong.
On a side note, I did think about calling a BAT file and referencing the environment variable there, but that doesn't solve anything for me as the main issue is actually knowning whether the application (and the bat file too) is on C: or D: drives - inside the drive itself the path is the same.
UPDATE: It turns out you can use them with a machine reboot but perhaps there is a better way
Thank you so mcuh! I've been struggling with it for days. I've been trying to restart the Scheduler service to no avail in Win7/Win2008 (need to run as SYSTEM to restart it), but this is so much simpler! – Timur – 2014-05-15T14:47:31.017