问题
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?
回答1:
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.
回答2:
Can it be that making the folder in C: needs Admin rights? Try creating the folder on the desktop.
回答3:
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
来源:https://stackoverflow.com/questions/23384608/autorun-inf-opens-a-batch-file-which-creates-a-directory-doesnt-work