Automatically launch app on USB (through autorun?)

半城伤御伤魂 提交于 2019-11-26 12:41:32

问题


Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista.

I looked into \"autorun.inf\" and \"open\" entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is it possible to launch program automatically on all windows versions?

I don\'t care if autorun is disabled by user in Windows settings.


回答1:


First of all, some people choose to disable autorun for security reasons; but Windows computers up to Vista have it enabled. Edit: Apparently the functionality was removed from Windows 7 onwards.

Put a file named autorun.inf in the root of your USB flash drive. This is what's in mine:

[Autorun]
Open=PStart.exe
Action=Start portable apps
Icon=diskicon.ico

What it does: when you insert this disk, starts PStart.exe

On older computers, the program specified in Open= will launch automatically.

On most modern computers (Windows XP SP2+, Vista), dialog "what do you want to do" will be displayed (for security reasons), but what you have in autorun.inf will display as the selected default, with Icon= as icon and Action= as description. If you want to launch it, just click the "OK" button in the dialog.

So, although I'm not aware of any way to start the application (e.g. PStart) immediately, it is possible to insert flash disk with this configuration and start application by clicking OK.

Tested on different computers, running Windows XP without a SP, also on Windows XP sp 1, sp2, sp3, and on various Vistas (not sure which types, but should work all the way from Vista Home Basic to Vista Enterprise Super-Mega-Premium-Extended Edition) and "Windows 7". Also works on Windows 2000 (although autorun on Win2000 for removable drives is not enabled in default configuration).

Note that some applications, in addition, may trigger the "unknown/unsigned exacutable" security dialog, as if you opened them manually.

Edit: For more details, see also:
Autoplay in Windows XP: Automatically Detect and React to New Devices on a System




回答2:


I've had something set up on my USB keys for a while now. Using the autorun.inf file will work, depending on your system's settings for autorun. Some disable it altogether after that little debacle with Sony a couple years back installing rootkit software on peoples' machines. Here're a couple articles to check out.

Label a Flash Drive with Your Name and Number

Have Your Lost USB Drive Ask For Help (1) or 2




回答3:


you need UseAutoplay to let this work on usb.

and if you take ShellExecute instead of open you can also open scripts/documents/...


[Autorun]
ShellExecute=System\something.exe
UseAutoplay=1 



回答4:


there are also U3 usb sticks arround, they will be reconised as cdrom drives in windows. if you put an a autorun.inf on one of those, it will get executed without the user being questioned.

regards morla




回答5:


I found the solution in this blog

How To Auto-Launch Apps With A USB Stick [Windows]

It worked fine for me

(the article explains how to do it with AutoIT, a 3rd party app that must be installed on the host computer)



来源:https://stackoverflow.com/questions/255006/automatically-launch-app-on-usb-through-autorun

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!