I'm learning how to create an automatic script in python (3.7) and I've noticed of these different behaviours:
(The python script is not relevant in this question but it works quite well so that I'm sure the answer of my question isn't here).
Case 1:
I create a batch file "test.bat" with this content:
test.bat
START "test" "C:\Users\cooper\AppData\Local\Programs\Python\Python37-32\test\v4.py"
I execute it (double click) and it opens a first window and right after closes it, and just after opens a second window with the title: "C:\Windows\py.exe" and the python script works well.
Case 2:
I create a cronjob on the cron task scheduler with an action to execute the batch file.
The cronjob is the standart one:
- Trigger: on a specific time, execute it X times in a day
- Action: execute the batch file
- I also changed an option called: configuration (W10 in my case).
When the file is executed it opens the first window and immediately after closes it, and just after it opens the second window and immediately after close it.
I would like to run the python script but doing it through the cronjob but whatever I do, it doesn't work. I've tried other variations on the batch file using cd and directly using:
"C:\Users\cooper\AppData\Local\Programs\Python\Python37-32\python.exe" "C:\Users\cooper\AppData\Local\Programs\Python\Python37-32\test\v4.py"
but none of them works. Idon't remember well the first, but the second shows command line on System32 directory and doing nothing.