1

I'm trying to make a autorun.inf file which would open a .bat file from a flash drive.

What I have in the autorun.inf file:

[autorun]
open=launch.bat
icon=icon.ico

What I have in the launch.bat file:

@echo off
::start

mkdir "C:\ThisIsATest"

exit

When I have inserted the flash drive to my personal computer, I have noticed that the icon of the drive has changed, but I can't see the effect of the launch.bat file. I have tried the batch file to see if it works and it works. Thus, I believe that the autorun.inf file doesn't work.

As I have read from the Internet, it matters that I have Windows 8 and Windows 7.

What can I do to solve this problem?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Martin Rezyne
  • 445
  • 3
  • 9
  • 24

3 Answers3

2

autorun.inf is not executed anymore on flash drives. These days it only works for CD's or DVD's, but the user still needs to allow it first.

ZippyV
  • 12,540
  • 3
  • 37
  • 52
  • Yes. I have read about something like this. But what should do the user to allow the autoplay.inf to run? On the computer where I have tried the flash drive, it doesn't pop up any message to inform the user about the flash drive. In addition, I have checked in the Control Panel if the AutoPlay is used for all media and devices. – Martin Rezyne Apr 30 '14 at 09:57
  • I wouldn't bother with trying to get autorun.inf to run, it won't happen and you cannot expect your users to change any settings to make it work. – ZippyV Apr 30 '14 at 10:28
  • 1
    @Sony: Read again what ZippyV wrote: autorun.inf is not executed from flash drives. It's not going to prompt the user for permission, because **it is not executed**. There is no setting to change it. – Ken White May 01 '14 at 00:29
0

Can it be that making the folder in C: needs Admin rights? Try creating the folder on the desktop.

-1

Try using this instead:

[autorun] 
icon=icon.ico
open=launch.bat
action=Click to run.
shell\open\command=launch.bat

Hope it helps.

Edit: You could also try compiling your batch file into a exe using this: http://www.battoexeconverter.com/

Try having a look here: http://www.sevenforums.com/tutorials/216706-autoplay-enable-disable.html

09stephenb
  • 9,358
  • 15
  • 53
  • 91