1

I wrote a backup script using Python and I used cx_Freeze to convert it into backup.exe. I put this executable on my USB flash drive. If I run C:\> E:\backup\backup.exe, it works, my files are copied to the USB flash drive.

Then I put this autorun.inf:

[autorun]
open=backup\backup.exe
label=BackupUSB

When I plug the USB flash drive, the label is correctly set to BackupUSB but the files are not copied. Why?

EDIT: I added a line action=Run backup in the autorun.inf but the option is not displayed in the menu...

clemtoy
  • 1,681
  • 2
  • 18
  • 30
  • 4
    Because autorun from USB was disabled like 10 years ago for security purposes? – CodeCaster Oct 06 '15 at 10:07
  • 1
    Possible duplicate of [Automatically launch app on USB (through autorun?)](http://stackoverflow.com/questions/255006/automatically-launch-app-on-usb-through-autorun) – CodeCaster Oct 06 '15 at 10:09
  • @CodeCaster I checked, it is enabled on my Windows 10. – clemtoy Oct 06 '15 at 10:32
  • Define "it" and "enabled". You cannot autorun directly from an USB drive since somewhere around Windows Vista, period. Some USB sticks can launch executables on insertion because they have a hidden CD drive that does support autorun. The "beauty" of USB at work. – CodeCaster Oct 06 '15 at 10:40
  • @CodeCaster The checkbox [Control Panel > AutoPlay > Use AutoPlay for all media and devices] is checked. As I use a french version, I just understood that "autorun" is not "autoplay"... If autorun is not possible I just would like to display the option (using `action=` in `autorun.inf`?) in the menu when I plug the USB flash drive... But it doesn't work neither: the action is not displayed in the menu. – clemtoy Oct 06 '15 at 12:54
  • That is also not possible, thanks to [Conficker](http://www.microsoft.com/security/pc-security/conficker.aspx) (see [screenshot](http://www.microsoft.com/global/security/publishingimages/pc-security/Autoplay.jpg)). I guess the answer to your question then simply is _"This is not possible"_, mind if I post that? – CodeCaster Oct 06 '15 at 12:56
  • @CodeCaster Ok! thanks – clemtoy Oct 06 '15 at 13:01

1 Answers1

4

The commands "open" and "action" only works in Windows Vista and Windows XP only. After Windows 7, Microsoft removed this feature from USB stick due to security problems. So from Windows 7 to the latest version of Windows will not support "open" command and "action" command.