I have an application which gets called by a scheduled task. It moved from Windows Server 2003 to Windows Server 2008. On 2003, the app ran in the directory where the execut
I hope people will see this answer for the XML approach (frankly I think that it's a cleaner method and there's some better documentation around what parameters you can set to configure specific features within the task too).
Step 1: create XML file that sets all task settings, several places for more info on XML elements:
Step 2: Specific to "where" the task will execute from (as in the starting directory the script will commence in the command line, this is directly related to the OP's question....You'll need to configure the parameter like so...
2012-08-19T16:49:14.6182
YOUR-COMPUTER-DOMAIN\YOUR-USERNAME
... a bunch of other stuff in between here ....
C:\PythonEXE\mini_program_test.exe
C:\Some\where\here\
Please note above that there aren't any quotation marks in the WorkingDirectory paramater -- I made that mistake earlier.
Step 3: Since you'll be using schtasks.exe in order to CREATE this new task via the XML, take a look here for more info: https://msdn.microsoft.com/en-us/library/bb736357.aspx
Step 4: In the windows command line, you'll execute something like this (once your XML is ready)
C:\>schtasks /CREATE /TN "TASK-NAME-HERE" /RU "YOUR-USERNAME" /RP "YOUR-PASSWORD" /XML C:\YOUR-XML-FILE-LOCATION\ready.xml
Hope this helps out a bit -- have fun!