【发布时间】:2009-04-23 21:07:49
【问题描述】:
我有一个脚本每 5 分钟在我的 PC 上检查一次,我不希望 Python 显示在我的任务托盘上。我使用 Windows 作为我的操作系统。
有什么方法可以让 Python 在后台运行并强制它不在我的任务栏中显示?
【问题讨论】:
标签: python windows backgrounding
我有一个脚本每 5 分钟在我的 PC 上检查一次,我不希望 Python 显示在我的任务托盘上。我使用 Windows 作为我的操作系统。
有什么方法可以让 Python 在后台运行并强制它不在我的任务栏中显示?
【问题讨论】:
标签: python windows backgrounding
如果您使用pythonw.exe 运行控制台脚本,它既不会显示窗口也不会出现在任务栏中。例如,我使用以下命令在启动时启动ntlmaps:
C:\BenBlank\Python2.6\pythonw.exe scripts/ntlmaps
但请注意,无法与脚本交互,也无法通过任务管理器终止脚本。
【讨论】:
您还有另一个选择:
你可以为你的 Python 脚本创建一个快捷方式,然后right-click the shortcut --> Properties --> Shortcut tab
运行选项下有一个下拉框,可让您最小化运行命令。
【讨论】:
您可以将其作为服务运行。见here
【讨论】:
在 linux 上运行它;在Windows上安排它[控制面板>计划任务>添加计划任务]
【讨论】:
从任何地方运行 python 文件:
第 1 步:
Create Shortcut of Python File.
第 2 步:
Place Shortcut in this location C:\ProgramData\Microsoft\Windows\Start Menu\Programs
第 3 步:
Now Right Click --> Go to Properties --> Shortcut --> Press any key on keyboard it will take one shortcut key
第 4 步:
Now , Type the Shortcut key which you entered in previous step.
第 5 步:
Check out Output! :)
【讨论】:
在控制面板中查找计划任务。
【讨论】: