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

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,


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

thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dev AdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
In Windows 7 or above AutoPlay will not support the AutoRun

Is security feature that was introduced for contrast Conflicker
MichaelBalackAuthor 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?

Dev AdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
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
MichaelBalackAuthor 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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.