Make a DOS Command

by puffyfluff in Circuits > Microsoft

48691 Views, 15 Favorites, 0 Comments

Make a DOS Command

main.jpg
Many people think that DOS is outdated, but I don't think so. You can do many things with DOS,and even Eric Wilhelm uses it! (See here) Some of the things you can do with DOS include giving yourself access to important files (good for hacking), deleting things, backing up things, showing all the files and folders in a folder, making simple but harmful viruses, and reformatting hard drives (!!). Unfortunately, when you want to run a program you made, you must type in the location if you want other information to be passed on to it. This instructable will teach you how to essentially make a command so you don't have to do this.

Making the Program

Start by making a DOS executable. A DOS executable is a program that is run through CMD. These files can have six extensions: .exe, .com, .bat or .cmd .vbs or .vbe. Note that that you can use things passed into the program with %1, %2, %3 and so on.

When you have the program ready, rename it to the command you want, followed by its extension. Note that the command cannot contain spaces.

When ready, continue to step two.

Transform It Into a Command

Icon.jpg
This is what turns it into a command. Copy the file into C:\WINDOWS\system32\. That is all you need to do. To test it, open cmd by typing "cmd" into start>Run and hitting enter. Test your command. Just type the name of the file, no extension. For example, if you want to go to instructables, just copy the attached file into C:\WINDOWS\system32, and then type "instructables" in cmd.

Note-The picture is making the icon for the program, which I did in .IcoFX

Downloads

How It Works

sysprop.jpg
sysprop2.jpg
enva.jpg
sys32.jpg
Press the windows button and pause/break on your keyboard. It will bring up a dialog called System Properties. Click the advanced tab. At the bottom, click environment variables. In the lower group box, scroll down to Path and PATHEXT. You will notice that the first thing in Path is C:\WINDOWS\system32. That is the directory that you put your command file in. Whenever you type in the command, it looks there for that file. In the PATHEXT variable, you will see the six main extensions you can use for your file, along with some others. If the file is in a directory that it is in the path variable, then you won't have to type a location. If its extension is in the PATHEXT variable, you won't have to type its extension. You will also notice that in C:\WINDOWS\system32, there are files like help.exe, xcopy.exe, and other DOS commands. They are being run the same way your command is run. You can prove this by opening CMD and typing your command. It will work. Then type "path ;" and hit enter. That will clear the path and make CMD look only in the current directory. Then, do CD and then another directory that is not C:\WINDOWS\system32. Now try your command again. It will not work. If you try a random DOS command, it might not work. For example, xcopy, help, attrib, cacls, chkdsk and taskkill will all not work anymore. That is because the path is cleared! This also means that if your program is in "C:\I am puffyfluff", then you could just add ;C:\I am puffyfluff to the end of the path variable, and you wouldn't have to copy it to C:\WINDOWS\system32.

Now you know how to make your own command!