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 workaround for this without killing the task scheduler process?
Use cmd /c
to start the program, this will allow access to environment variables. eg:
cmd /c start %my_exe_path%\myexe.exe