albeck
albeck

Reputation: 520

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.

Upvotes: 4

Views: 37320

Answers (2)

Dave
Dave

Reputation: 8461

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/

Upvotes: 2

Captain Skyhawk
Captain Skyhawk

Reputation: 3500

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.

Upvotes: 2

Related Questions