How to run a python script in the background?

2019-01-07 14:14发布

I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system.

Is there any way to make Python run in the background and force it to not show in my task tray?

5条回答
【Aperson】
2楼-- · 2019-01-07 14:17

Just another option you have:

You can create a shortcut to your Python script, then right-click the shortcut --> Properties --> Shortcut tab

There is a drop-down box under the Run option which lets you run the command minimized.

查看更多
Melony?
3楼-- · 2019-01-07 14:21

cron it on linux; schedule it on windows [control panel > scheduled tasks > Add scheduled task]

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-01-07 14:28

Look for Schedule Tasks in the control panel.

查看更多
欢心
5楼-- · 2019-01-07 14:29

You could run it as a service. See here

查看更多
爷、活的狠高调
6楼-- · 2019-01-07 14:35

If you run a console script using pythonw.exe, it will neither display a window nor appear in the task bar. For example, I use the following command to launch ntlmaps on startup:

C:\BenBlank\Python2.6\pythonw.exe scripts/ntlmaps

Be aware, however, that there is no way to interact with the script, nor to terminate it save via the Task Manager.

查看更多
登录 后发表回答