在Windows上启动时运行Python程序 [英] Run a Python program at start-up on Windows
问题描述
我正在开发Python上的按键记录器(仅出于好奇的缘故).该脚本将是可执行文件.由于无法访问计算机,因此该过程不需要用户界面或用户交互.
I am developing a key-logger on Python (only for curiosity sake). And the script will be an executable. Without access to the computer so the process should not need a UI or user interaction.
有没有办法,甚至在另一个可执行文件中也可以使按键记录器在启动时启动?
Is there any way, even in another executable to make the key-logger start at start-up ?
推荐答案
我不使用Windows,但是您可以尝试制作一个运行您的python文件的batch
脚本,并使该脚本
I don't use Windows, but you can try making a batch
script that runs your python file and make that script Run a program automatically when Windows starts:
-
单击开始"按钮开始"按钮的图片,单击全部" 单击程序",右键单击启动"文件夹,然后单击打开".
Click the Start button Picture of the Start button , click All Programs, right-click the Startup folder, and then click Open.
打开包含要创建快捷方式的项目的位置
Open the location that contains the item you want to create a shortcut to.
右键单击该项目,然后单击创建快捷方式".新的 快捷方式出现在与原始项目相同的位置.
Right-click the item, and then click Create Shortcut. The new shortcut appears in the same location as the original item.
将快捷方式拖动到启动"文件夹中.
Drag the shortcut into the Startup folder.
正如我所说,我不使用Windows,所以它可能是完全错误的.
As I said, I don't use Windows, so it might be totally wrong.
您可以参考此处以制作BAT
文件,基本上说:
You can refer here for making the BAT
file, which basically says:
@echo off
python c:\somescript.py %*
pause
这篇关于在Windows上启动时运行Python程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!