Search code examples
pythonpython-3.xautorun

Autorun python file when USB is conected


I want my python file (Stored in my USB drive) to run automatically when USB is connected to my pc

I have tried this

[autorun]
open = MyFiles.py

saved it as "autorun.inf"

But it's not working at all


Solution

  • This is not possible on any modern OS. This is due to security concerns. Thus, Autorun is no longer a possibility in Windows. The only way to automatically execute stuff on Windows/Linux/MacOS is to change the registry key on Windows or use a Rubber Ducky.