Make your own cmd prompt Commands

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mason
Posts: 4
Joined: 28 Jan 2009 18:02
Location: 3 Ethical Hackers dot com
Contact:

Make your own cmd prompt Commands

#1 Post by Mason » 02 Feb 2009 20:43

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.

jaffamuffin
Posts: 40
Joined: 25 Jan 2008 14:05

#2 Post by jaffamuffin » 05 Feb 2009 13:58

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.

spam_killer
Posts: 12
Joined: 10 Oct 2008 04:50

Errrr..

#3 Post by spam_killer » 11 Feb 2009 07:16

I not understand at all what is the purpose of these command.. Create my own command? How?

Post Reply