How to get the batch file executed upon usb thumb drive plug in?

MichaelBalack
MichaelBalack used Ask the Experts™
on
This is an intention to run a batch file from the usb thumb drive when this thumb drive plug into the desktop or laptop. Targeting MS WIndows  7/10/2008/201. Please see the contents of the autorun.inf as follows,

[Autorun}
ShellExecute=PCChecking.bat
UseAutoPlay=1

The "autorun" didn't seem to fire up.  How to get this automatic function works?

thanks in advance.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Principal Software Engineer
Commented:
Autorun is disabled by default on all recent versions of Windows.  This was done by Microsoft for extremely good reasons.  Any system that automatically executes autorun files on removable medium devices is begging to be infected by any virus or malware that comes along.

Autorun is either on or off.  It can't be enabled just for one particular device.

The autorun function can be re-enabled, but IMO it is a very, very bad idea to do so.  It is not much extra overhead to require the carrier of the thumb drive to initiate the program on it manually, and doing it that will will not blow a hole in the system's security.
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical Speaker

Commented:
In Windows 7 or above AutoPlay will not support the AutoRun
https://blogs.technet.microsoft.com/srd/2009/04/28/autorun-changes-in-windows-7/

Is security feature that was introduced for contrast Conflicker
MichaelBalackSenior System Engineer

Author

Commented:
Hi both,

Can Auto Play be used ? So as a screen, with the given batch file presented for running?
Or else, any alternative way with minimal intervention from the user?

Thanks,
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical Speaker

Commented:
Autoplay is not a best practice... the correct way is start manually

But try explain better your scenario and why you want give to yours users an autostart thumb drive for execute a bat, so we try suggest an alternative solution
MichaelBalackSenior System Engineer

Author

Commented:
Thanks for both experts - Dr. Klahn and Ermanno in pointing out the autorun and autoplay are "prone" to introduce viruses into the PC. Now, I get the user to run the required batch file instead and this works.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial