How to create an autorun on a USB for windows 10?


I made a small program in C# , this I have it in a usb memory that saves the windows user of the pc where the usb is connected, but I want it to run every time I connect it to a pc with windows but that is transparent for the user, I was trying with autorun.inf but I understand that this type of file no longer works in USB memory and that CD itself, but since my PC does not have a reader I did not do the test so fast, they have some idea of how to make the .exe run automatically on the USB, if the autorun works on CD try to cheat windows that the USB is a CD or that it can be done with a program in ensamblador .

asked by roboto10 26.11.2018 в 18:46

1 answer


The functionality was removed from Windows 7 onwards, computers with Windows to Vista have it enabled although it is possible that for security reasons it is disabled.

To do so, place a file called autorun.inf in the root of your USB flash drive with the following:

Action=Start portable apps

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

On most modern computers (Windows 7, Windows 10), the "What do you want to do?" dialog box will be displayed. (For security reasons), but what you have in autorun.inf will be displayed as the default value selected, with Icon="..." as icon and Action="..." as a description. If you want to start it, simply click on the "Accept" button in the dialog box.

Testing on different computers, running Windows XP without SP, also on Windows XP sp 1, sp2, sp3 and on several Vista (I'm not sure what kind, but it should work from Vista Home Basic to Vista Enterprise Super-Mega Edition Premium-Extended) and "Windows 7". It also works in Windows 2000 (although autorun in Win2000 for removable drives is not enabled in the default configuration).

Please note that some applications may also activate the "unknown / unscheduled sign" security dialog, as if opening them manually.

answered by 27.11.2018 в 07:19