I have task scheduled a batch file to run at midnight.
- It has highest privileges,
- It is ran as administrator with a stored password, independent of whether the user is logged in or not
- The environment is set to windows 2012
- The batch file's folder is used when launching.
Batch file location and start folder respectively:
c:\ip\ip1.bat
c:\ip\
Batch file contents:
taskkill /im python.exe /f >nul 2>&1
taskkill /im chrome.exe /f >nul 2>&1
timeout 5
netsh interface ipv4 add address "Ethernet" 104.122.112.106 255.255.255.0
timeout 5
::netsh interface ipv4 delete address "Ethernet" 104.122.112.106
netsh interface ipv4 delete address "Ethernet" 104.122.112.107
netsh interface ipv4 delete address "Ethernet" 104.122.112.108
timeout 40
start /min "" python.exe C:\Users\Administrator\Desktop\host\server2.py
timeout 10
start /min "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="D:\chrome1" --js-flags="--expose-gc"
The above batch works perfectly if launched manually.
However, whenever the above file is launched by the task scheduler, it is being executed only partially.
What happens is that both python and chrome processes are killed but not restarted.
Nevertheless, the task scheduler reports that last run result was successful (0x0).
I highly appreciate your help and suggestions.
EDIT:
ACTUALLY, both processes are launched!
However they are ran in the background, that is, I see them in task manager but I cannot interact with them in any way.