Introduction: Run Command Prompt When You Click on Your Flash Drive

Picture of Run Command Prompt When You Click on Your Flash Drive

What I'll show you how to do today is to make a message open up when you click on your jump drive from My Computer in windows. You will learn to create (or modify) an autorun.inf in the root of your jump drive and create a batch file to be run when you open your jump drive. I will also show you how to display a message when that batch file opens, and optionally add a command prompt to the end that looks like an innocent blinking underscore. Basically, from here, you can do almost anything on a computer that you can't do because of a limited account.

For rather tech suavey people, step 6 is a short version of the whole instructable.

For rather un-tech suavey people, step 7 includes everything you need, plus a simple file
to install it to your jump drive.

Step 1: Gather Supplies

Picture of Gather Supplies

Get a working jump drive, any size. I'll be using an 8 gig Verbatim jump drive, but really you could do this with a 50 kilobyte jump drive. You will need to be running windows to use it, but any OS can make it. Open up notepad or your OS equivalent. In windows, go to Start-All Programs-Accessories-Notepad .

Also, it might help to have Folder Options under Control Panel set to show hidden files and folders.

Step 2: Create the Batch File

Picture of Create the Batch File

Paste the code below into notepad.

echo Help! I've been lost. I'm sure my owner would love to get me back.
set /P theuserinput=""

Go to File and save the file. Save it to the root of your jump drive. Select to save it as type "All Files" and for the filename, type in "lost.bat". This should save it as a batch file. If it shows up as .txt, disable the option of hiding known file extensions under Folder Options in Control Panel. Then it would show up as "lost.bat.txt" (YOU DONT WANT IT LIKE THAT). The icon should be a yellow gear, not a piece of paper. The full name should be lost.bat.

You can choose to edit lost.bat. I have added more lines that display my address, name, phone number, etc so If my jump drive is lost hopefully somebody will return it, of course after also telling them about a cash reward. Just start the line with the word "echo" and then type what you want to display on that line.

Step 3: Create Autorun.inf

Picture of Create Autorun.inf

Now, open a new document in notepad. Paste this into it.

shell\lost=Help! I'm lost!

Change the part where it says JUMPY to whatever you want the drive name to be.. Save this file in the root of the jump drive. As you did with lost.bat, set the "Save as type" as all files. Set the file name to "autorun.inf". Go to the root of the jump drive in windows. The file autorun.inf should have an icon as a piece of paper with a yellow gear on it.

Step 4: Optional- Make the Files Hidden

Picture of Optional- Make the Files Hidden

You may want to make each of the files hidden. Most computers won't display hidden files, so if some non-tech-suavey deletes all the files off your jump drive, they still see your message, so somebody is bound to see it and eventually you might get it back if it gets lost. Right click autorun.inf and select properties. Check the mark for Hidden next to attributes. If you haven't disabled the function to not show hidden files and folder, then it appears to disappear. Do the same for lost.bat.

Or you can just go to command prompt and do the following commands (my jump drive is drive L)

ATTRIB autorun.inf +H
ATTRIB lost.bat +H

Both of the above methods do the same thing.

Step 5: Closings

Picture of Closings

That's pretty much it. Close everything out and replug your jump drive. Go to My Computer and try to open your jump drive. The message should show up and after that let you type something in. Anything you type in is like you typed it into command prompt. You can do CMD to get a normal command prompt in the same window. If you don't know much about command prompt, there are guides out here that can show you how to do lots of stuff. One VERY useful site would be . Somebody had reposted it on one of my favorite forums, but I just googled it and found that site. Really, go check it out. And, as I promised, the short-short version is on step 6.

Step 6: Short Version

Get a jump drive. Make a batch file named lost.bat in the root of it. Add this code to it-

echo Help! I've been lost. I'm sure my owner would love to get me back.
set /P theuserinput=""

Make a file called autorun.inf in the jump drive root. Add this code to it-

shell\lost=Help! I'm lost!

Get an icon and name it slax.ico (nope, I definitely didn't steal the icon from slackware.....)
Optionally make lost.bat and autorun.inf hidden (so people can't delete it). Open up command prompt and do this (my jump drive letter is L)

ATTRIB autorun.inf +H
ATTRIB lost.bat +H

You're done.


I knew some people wouldn't get it, so I made a rar file with everything in it you need. Extract it (please, please, please tell me you AT LEAST know how to do this, I suggest using winrar) and run the file called INSTALL.bat by double clicking on it.

This file asks you for the drive letter of your jump drive and copies the files over to it.
Install it once, then unplug it and see what it does. From there you can try to edit the files to make it say something different. By default, it will display this when you hook it up-

Help! I've been lost. I'm sure my owner would love to get me back.
If you find me lost, please return me to them.
If you really want, I'll pay you for all your troubles.

The file is attached below (for some reason you have to change the extension from .tmp to .rar)
If you have trouble opening the first file, try the second one. It's a self extracting archive. It should end in .exe


felixstonel (author)2013-04-17

This is the strange problem I have never seen it before. But you may apply the good resolution winrar repair header corrupt

Tool must be useful for you

shadow wave rider (author)2011-08-04

how do you extract it. seriously please tell me. i honostly dont know how to extract it

I've attached an exe file to step 7. Just download the exe (and you probably need to change the extension from .tmp to .exe) and run it to extract everything.

Also, excuse me for the remarks I wrote about how easy it should be, etc. We tend to forget that not everyone specializes in the same areas we do. I would probably post easy questions on a cooking instructable, simple because I know computers, not cooking :) On that note, I was much younger when I wrote this, and have since learned to be a less critical person...

ok. thanks alot. i know what you mean. i know a decent amount of stuff about computers but some things i haven't done yet because i have never needed to do it. i like electronics but i am still learning

cool. this one works!!!!!:)

shadow wave rider (author)2011-08-02

when you say root of the drive ou mean in control panel dont you. and the gear is blue. is that because of windows 7.

The root of a drive refers to the highest level in the structure of folder. For example, the root of your hard drive is probably C:/. If it said C:/Users/, you would need to go up one folder to get to the root. Just go to my computer, then click on your jump drive. That should put you in the root, where you need to put the files.

You might also want to reference more updated instructables, like

VeryLAMEPerson (author)2010-03-29

But if they format the drive? They will be gone also!

ELMOHTARF (author)2009-11-03

thanks alot i downloaded it

ELMOHTARF (author)2009-11-01

where is the rar file

locofocos (author)ELMOHTARF2009-11-02
Sorry about that, I think I deleted it a while back because it had some personal information in it and quite frankly this isn't a very popular instructable. I've attached it to step 7 again, so you should be good to go.
jxxwatevaxxk (author)2009-04-07

Is it supposed to close every time you type something and press enter?

Arbitror (author)jxxwatevaxxk2009-07-03

You type that in notepad, not command prompt.

ledzep567 (author)2009-04-17

how would you "unhide" the files? as soon asi checked hidden they disappeared instead of going transparent. maybe because im on vista?

locofocos (author)ledzep5672009-04-18

It works mostly the same as XP. I can't guide you in Vista because I don't use it, but I can refer you to this site-

littlechef37 (author)2008-10-06

How would I go about hiding all the files on a drive ?

locofocos (author)littlechef372008-10-07

I tell you how to do this in step 4. Right click each file and select Properties. Then select Hidden next to the word attributes. Hit apply, then OK. The file will then become hidden. By default, windows computers are configured to not show hidden files. To enable seeing hidden files, open any folder in Windows. Click on Tools - Folder Options. Click the view tab. You will see "Hidden Files and folders". Enable "Show Hidden files and folders". Anyone who hooks the jump drive up to your computer will then be able to see the files (you might want to disable seeing hidden files and folders afterwards). On other computers, you would have to enable seeing them to see them. Because other computers are configured to not show them by default, people will have a harder time deleting them.

littlechef37 (author)locofocos2008-10-07

Automatically with a batch file ? I need a script that will automate file/folder hiding that can be run directly from a flash drive ! any ideas ?

locofocos (author)littlechef372008-10-08

Do you mean a script that will enable hidden files and folders or something that will make the files hidden? Here's something that will enable hidden files and folder being seen. Don't copy the lines. Paste it in notepad and save it as "something.reg"-

Windows Registry Editor Version 5.00


That will enable you seeing them. This will disable you seeing them, like default (again, don't copy the lines)-

Windows Registry Editor Version 5.00


That will modify the registry for you. If you can't get it to work right, I'll post the files here.

Sciencefreak686 (author)2008-07-17

umm... it won't work.i used the easy install method. and it still doesn't work any ideas? i have no clue what is wrong with it. i'm a beginner to the cmd prompt