Task Scheduler running a .cmd
Posted on 2013-02-03
We have resently moved from windows server 2003 to windows server 2008 service pack 1.
In Windows server 2008 I'm using task scheduler to run a .cmd script.Just as it was in window server 2003.
The first command in the script is to run another .cmd script. Lets call it myenv.cmd.
Myenv.cmd sets the environment variables for 5 other scripts that also need to be scheduled and is called once from each of those 5 scrpts.
If I run it from the command line it works fine. If I run it through the scheduler or let the scheduler run it, the myenv.cmd runs but the variables on not set for the calling cmd script.
If I move all the setup commands from myenv.cmd to the calling cmd script it also works. I really don't want to add all the set up code to each of the 5 calling scripts. Is there another way?
:: this is my calling script
:: the first thing it does is call another cmd to set up environment variables.
:: do some more stuff