问题
I just noticed that windows 7 task scheduler doesn't use the latest updated environment path variable. Task scheduler is up and running and I changed the path variable. New processes that run in the task scheduler have the old path. I had to kill the taskeng.exe so that it can start using the latest path. So looks like Task scheduler spawns new processes as child processes rather than new parent processes. Is there any work around for this without killing the task scheduler process?
Regards, AJ
回答1:
Use cmd /c
to start the program, this will allow access to environment variables. eg:
cmd /c start %my_exe_path%\myexe.exe
回答2:
Changing the account that the job is running under in the scheduler worked for me (on win server 2008 r2).
来源:https://stackoverflow.com/questions/11824319/windows-7-task-scheduler-doesnt-use-updated-path