2

I have a job scheduled to run at 9:30 every day using Windows task scheduler. The problem is after it runs, the command prompt stays open. Does anyone know how to get it to close?

New "Action" window

The full text in the "Add arguments (optional):" field is:

C:\WinPython64bit\notebooks\TreasuryTest.py exit 0

I have searched all over, but most fixes are for use directly in the command prompt, and it seems to function differently from the task scheduler.

Kyle
  • 2,543
  • 2
  • 16
  • 31
  • You are directly calling cmd, which is the command prompt. I would suggest the solutions you found would apply to this scenario. Tho, since you are directly calling WinPythonInterpreter, why don't you set that as the target executable instead of cmd? – Joel Lucsy Feb 08 '17 at 19:43
  • The solutions typically had something to do with the `/c` command line switch and the `exit 0`. Neither of these worked. The other one was `start "" ....` which wouldn't even run.I changed how I call the python interpreter and edited my question accordingly. I still have the same issue, command prompt opens and does not close. – Kyle Feb 08 '17 at 20:57
  • 1
    I suppose "WinPythonInterpreter.exe" is running another console program that continues after the script exits. Is it an instance of the cmd.exe shell? I don't use this distribution of Python. Doesn't it have the regular python.exe and pythonw.exe executables, maybe in a subdirectory? – Eryk Sun Feb 09 '17 at 09:12
  • Not sure why that matters, but using `python.exe` worked. Thanks much @eryksun. – Kyle Feb 09 '17 at 15:07

0 Answers0