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.