Page 1 of 1

Make your own cmd prompt Commands

Posted: 02 Feb 2009 20:43
by Mason
Ever typed a batch but got sick of how long it took because of the repetitive typing? Lets make some shortcuts

When you use a command, basically you are starting a file with certain attributes. To find out where all of these files are located, open CMD, and type path. It will display all of the possible locations that a command could be located. 99.99% of the time, however, they are located in the System32 folder, which is located in the C:\Windows folder. This is where we will put ours, A command is basically a batch file that takes the user defined attributes and changes the computer in the intended way. To do this, you must use the variables %1, %2, %3, ... etc. We will not use %0 because that would just return the filename of the command. To begin, start notepad. Now write your command in the file. Here I have a few examples. (Hint: You will want to begin each line with an @ so it will not display the process)

Wait- Since my computer does not currently feature a wait command, I made one myself.

@echo off
if %1 EQU ? GOTO SYNTAX
PING 1.1.1.1 /n 1 /w %1 >NUL
GOTO END
:SYNTAX
ECHO WAIT xxxxx
echo xxxxx Number of millaseconds to wait
:end

When you save your command, you want to save it as the word you want the command to be. Ex. wait.bat = Wait. Save as type: "All files". Now, up at the top, navigate to C:\, then C:\Windows, C:\Windows\System32. Now you can save your command.

Posted: 05 Feb 2009 13:58
by jaffamuffin
I prefer to make a specific scripts directory . e.g. C:\scripts and add that to my %PATH% environment variable.

this way it keeps the system dirs tidy, and i know what i'm dealing with just by looking in there.

Errrr..

Posted: 11 Feb 2009 07:16
by spam_killer
I not understand at all what is the purpose of these command.. Create my own command? How?