问题
For a customer we created a software which will be installed at about 350 USB sticks. Now we want that this .exe is automatically executed when the stick is plugged into the PC.
A few years ago we used the simple autorun.inf
method.
But for Windows 7 and later Windows versions this function is not longer working as I've seen. That makes me a little bit wondering because in my system control I can select how the drive will be opened. At "software and games" I selected "always ask", then I put this Autorun.inf
on the stick:
[autorun]
open=Demo1.exe
But it's not working. The only thing that Windows makes when I plug the stick into, it asks whether I want to open the drive folder.
What I have to do that the software starts automatically OR a window opens in which the user can decide to run the executable or don't do that?
回答1:
For Windows 7 and later only optical drives can specify auto run tasks. Indeed earlier versions of Windows can be patched to behave the same way. This change was made in response to the Conficker worm.
So your goal simply cannot be achieved. You will need to instruct users to explore the memory stick and run a specific program manually.
回答2:
You cannot specify autorun.inf tasks for USB drives. Read here for futher Information: http://blogs.msdn.com/b/e7/archive/2009/04/27/improvements-to-autoplay.aspx
回答3:
Previous answers from David Heffernan and Mofi are right. Only CD/DVD/Optical drives are allowed to specify auto run tasks.
BUT, if you identify the manufacturer of the USB chip and get the firmware management tool for this chip, you can reconfigure it and get the USB to appear as a CD drive to the OS.
If this seems an overhelming task, you can get your USB created by some companies dedicated to the distribution of multimedia content.
回答4:
And Microsoft released for Windows XP, Windows Vista, Windows Server 2003 and Windows Server 2008 the security hotfix KB967940 explained at Microsoft Security Advisory (967940) which disables the autorun feature for all drives except CD and DVD drives. See also ZDNet article Microsoft disables AutoRun on Windows XP/Vista to prevent malware infections.
So it is not possible anymore that something is automatically started when a writable USB flash memory device is plugged in to prevent malware to run automatically.
来源:https://stackoverflow.com/questions/21076969/is-there-an-alternative-for-autorun-inf-for-windows-7-8-8-1-10