USB连接时自动运行python文件

问题描述

我希望我的 python 文件(存储在我的 USB 驱动器中)在 USB 连接到我的电脑时自动运行

我已经试过了

[autorun]
open = MyFiles.py

将其保存为“autorun.inf”

但它根本不起作用

解决方法

这在任何现代操作系统上都是不可能的。这是出于安全考虑。因此,自动运行在 Windows 中不再是可能的。在 Windows/Linux/MacOS 上自动执行内容的唯一方法是 change the registry key on Windowsuse a Rubber Ducky