3

Windows 7 Task Scheduler is running my Python script every 15 minutes. Command line is something like c:\Python\python.exe c:\mypath\myscript.py. It all works well, script is called every 15 minues, etc.

However, the task scheduler pops up a huge console window titled taskeng.exe every time, blocking the view for a few seconds until the script exits.

Is there a way to prevent the pop-up?

Danijel
  • 8,198
  • 18
  • 69
  • 133

2 Answers2

7

Simply save your script with .pyw extension.

As far as I know, .pyw extension is the same as .py, only difference is that .pyw was implemented for GUI programs and therefore console window is not opened.

If there is more to it than this I wouldn't know, perhaps somebody more informed can edit this post or provide their own answer.

Doom8890
  • 435
  • 3
  • 15
  • Glad I could help, I edited the answer for clarification. – Doom8890 Mar 09 '16 at 22:56
  • 2
    Run the script using `pythonw.exe` instead of `python.exe`. The default association for .pyw files is to `pythonw.exe`. – Eryk Sun Mar 10 '16 at 06:19
  • OK, got it. I am now running `c:\Python\pythonw.exe c:\mypath\myscript.pyw`. More info at [pythonw.exe or python.exe?](http://stackoverflow.com/questions/9705982/pythonw-exe-or-python-exe). – Danijel Mar 10 '16 at 08:40
2

This helps me:

  1. In the “General” tab, under the “Security options” section, select the Run whether user is logged on or not option. (This is the option that will make the command window not to appear when the task runs automatically.)
  2. Clear the Do not store password option. (This is an optional step, but if the task isn’t working, check this option and supply the appropriate credentials to run the task.)

scheduled task hidden configuration