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...

7
  • 4
    Because autorun from USB was disabled like 10 years ago for security purposes?
    – CodeCaster
    Oct 6, 2015 at 10:07
  • 1
    Possible duplicate of Automatically launch app on USB (through autorun?)
    – CodeCaster
    Oct 6, 2015 at 10:09
  • @CodeCaster I checked, it is enabled on my Windows 10.
    – clemtoy
    Oct 6, 2015 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 6, 2015 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 6, 2015 at 12:54

1 Answer 1

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.

2
  • Then, what we should do to create auto-plays for our assistant disks?
    – Qaher
    Sep 11, 2018 at 8:09
  • any solution so far ?
    – Ahmad
    Nov 26, 2020 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.