I am trying to create a .bat file that will run automatically during a startup on my server. I want the .bat file to open CMD, go to a given directory and then run a Python script from there.
Once the Python script has been activated, I want a separate CMD window to run a shutdown timer so that after a given time (t=86400, daily) the system will reboot. This is my way of making sure the file will continue to run after I disconnect to my server.
My current code is
@echo off
start cmd /k cd C:/Users/Administrator/Documents/
python scraperv2.py
start cmd /k shutdown -t 86400 -r -f
This code will go to the directory C:/Users/Administrator/Documents but it will not run the Python script. Please note that Python is set as a PATH variable.
What do I need to do to get this script to work?
start ..?startbecause I thought it was a prerequisite for opening a program. I removed it but the issue remainsstart cmd /k cd C:/Users/Administrator/Documents/will start a new instance of cmd.exe but will not change the directory of the current one. Why you just dindn't usedcd /d "C:/Users/Administrator/Documents/"