Introduction: 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
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
Paste the code below into notepad.
@ECHO OFF
echo Help! I've been lost. I'm sure my owner would love to get me back.
echo
set /P theuserinput=""
%theuserinput%
pause
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
Now, open a new document in notepad. Paste this into it.
[autorun]
icon=slax.ico
label=JUMPY
shell\lost=Help! I'm lost!
shell\lost\command=lost.bat
shell=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
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)
L:
ATTRIB autorun.inf +H
ATTRIB lost.bat +H
exit
Both of the above methods do the same thing.
Step 5: 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 http://www.totse.com/en/hack/hack_attack/hackingyoursch179365.html . 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 OFF
echo Help! I've been lost. I'm sure my owner would love to get me back.
echo
set /P theuserinput=""
%theuserinput%
pause
Make a file called autorun.inf in the jump drive root. Add this code to it-
[autorun]
icon=slax.ico
label=JUMPDRIVE
shell\lost=Help! I'm lost!
shell\lost\command=lost.bat
shell=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)
L:
ATTRIB autorun.inf +H
ATTRIB lost.bat +H
exit
You're done.
Step 7: I AM SO CONFUSED!!!!!! HEEEELLLPPPP!!!!!!
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
20 Comments
9 years ago on Step 7
This is the strange problem I have never seen it before. But you may apply the good resolution winrar repair header corrupt
Tool http://www.winrarrepair.recoverytoolbox.com must be useful for you
11 years ago on Step 7
how do you extract it. seriously please tell me. i honostly dont know how to extract it
Reply 11 years ago on Step 7
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...
Reply 11 years ago on Step 7
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
Reply 11 years ago on Step 7
cool. this one works!!!!!:)
11 years ago on Step 3
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.
Reply 11 years ago on Step 3
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 https://www.instructables.com/id/Autorun-a-Jump-Drive/
12 years ago on Step 3
But if they format the drive? They will be gone also!
13 years ago on Step 7
thanks alot i downloaded it
13 years ago on Step 7
where is the rar file
Reply 13 years ago on Introduction
13 years ago on Introduction
Is it supposed to close every time you type something and press enter?
Reply 13 years ago on Introduction
You type that in notepad, not command prompt.
13 years ago on Introduction
how would you "unhide" the files? as soon asi checked hidden they disappeared instead of going transparent. maybe because im on vista?
Reply 13 years ago on Introduction
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- http://www.bleepingcomputer.com/tutorials/tutorial130.html
14 years ago on Introduction
How would I go about hiding all the files on a drive ?
Reply 14 years ago on Introduction
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.
Reply 14 years ago on Introduction
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 ?
Reply 14 years ago on Introduction
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
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Hidden"=dword:00000001
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
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Hidden"=dword:00000002
That will modify the registry for you. If you can't get it to work right, I'll post the files here.
14 years ago on Step 7
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