BREAK | CD CHDIR | CHCP | CLS | COPY | CTTY |
DATE | DEL ERASE | DIR | MD MKDIR | PATH | PROMPT |
RD RMDIR | SET | TIME | TYPE | VER | VOL |
VERIFY | LOCK | UNLOCK | LOADHIGH | EXIT | TRUENAME |
This command gives a listing of most of the files and directories on a disk
(Hard disk and floppy disk). In DOS 3.3 and below, there are only 2 known
switches:
/W - gives the directory listing wide
across your screen without times, dates, and sizes listed
/P - pauses the
output of the DIR command if there are more files than can be listed on your
screen at onceYou can use these two switches interchangeably with no
problems.
With DOS 5 and up you have MANY other switches you can use also. I hope to list them soon, although they don't do you much good.
UNDOCUMENTED: Use DIR followed by a comma to see EVERY file and directory, even if they're hidden! (Or have their SYSTEM attribute set).
C:\>DIR,Use DIR followed by 3 or more periods to see ONLY files and directories WITHOUT any extension.
C:\>DIR.... These two tricks only work on DOS 5 to 6.22. They should work for DRDOS as well. To view hidden and system files under DOS 7 (Windoze 95) use "DIR /A"
This command will dump the contents of a text file to your screen. Example:
C:\>type bill.txt
Bills stuff document.
Bill has 2 things:
1 basket ball
1 used sock
C:\>
This should mostly be used on plain ASCII text files. While you can use TYPE to print out an
executable program to the screen, it will be a bunch of junk and you'll get a lot
of annoying
beeps. TYPE will stop printing a file to your screen when it encounters an End-Of-File character.
This can come in handy if you want to keep something secret. I explain it on my
SECRETS page. You can also get fancy
and TYPE text files to things like your printer or Modem if you like.
C:\>type file.txt > lpt1
C:\>type upload.doc > com2
Note: With ALL versions of MSDOS and PCDOS you cannot use TYPE with wildcards (* and ?).
BUT, under DRDOS 7 you can.
DEL and ERASE
DEL and ERASE do the exact same thing- why someone would type out ERASE every time they wanted delete a file is beyond me. You can use wild cards with either command without any problems. You can also use them in batch files easily.
TECH EXPLANATION: these commands don't destroy any data. They simply
place the HEX character E5 (In HEX, E5 makes 1 ASCII character)
as the first letter in the file's name and blank out that files place in the FAT.
Don't confuse this with hiding a
file - that has to do with the files attribute setting. The DIR command
ignores any file it finds beginning with E5. If you delete a sensitive file on
a diskette- but don't copy anything back to the disk or over write it- that
document is still EASILY accessible. That's how UNDELETE and other utilities
work. They DO look for files beginning with E5 (They also have to track down which clusters
the file was stored on). If you don't have a program to
over-write files, you can just copy a "safe" file of the SAME LENGTH over top
of it.
MD and MKDIR
CD and CHDIR
C:\>cd windows
You will get a prompt like this:
C:\WINDOWS>
Now, wasn't that fun?! But wait, there's more! Oh know!! You need to get back to your root directory, and quick! Type "CD.." and you will be magically transported back to root. Ok, go back into any directory again. Now type DIR to see what is in there. You will notice that there are two sub directories, one called "." and the other called "..". They represent where you were and where you are. The "." is the directory you are in. ".." represents the parent directory, or the directory this directory is in (Confused yet?! Hang on, it'll get better the more you use it!). When you type "CD.." you are telling DOS to go to the directory you where just in. If you type "CD." nothing will happen since you are in that directory already. Pop quiz: what if you are about 7 directories in and you need to get to root? Instead of typing CD.. seven times in a row, use "CD\". Another trick; lets say that you are in your "C:\DOS>" directory and you want to get into "C:\GAMES\NES>"? Use this:
C:\DOS>cd \games\nes
You will be sent directly into your NES directory within your GAMES directory.
COPY
This command obviously copies files to different spots on your disks. It does not remove the source file after writing the new file. Usage:
C:\copy mystuff.doc A:
This example will copy "mystuff.doc" to your A: drive. Here's another example:
C:\copy mystuff.doc A:\stuff.doc
This copies "mystuff.doc" to the A: drive and renames it to "stuff.doc". Alright, say you want to combine two plain text files into one big happy file. This will accomplish that:
C:\copy mystuff.doc+herstuff.txt C:\house\ourstuff.yea
This combines "mystuff.doc" and "herstuff.txt" with the + symbol into one file
named "ourstuff.yea" in the HOUSE directory. Any questions?
SWITCHES: /A /B /V
The switch /A treats a file like an ASCII text file. This means that if the file has an
End-Of-File character in the middle of it everything up until the [E-O-F] character will be
copied. Anything after that will be chopped off.
The switch /B treats the file like a binary file and will copy EVERY
THING up the specified file length to the destination. If you have a
an ASCII text file with an End Of File maker in the middle of it, copy
will cut off every thing after the End Of File marker. Using the /B
switch will ignore all control characters including End Of File
markers. Example: if you try to TYPE the COMMAND.COM file to examine
its contents, it stops early before you get to see anything
interesting. Using the /B switch with copy we can see the ENTIRE
thing.
COPY /B COMMAND.COM CON
This chain of commands sends, without interruption on End Of File control characters, the contents of COMMAND.COM to the CON device, which is your screen. It will beep a lot and take a long time to all go by, but you will be able to see all of its error messages and commands it will accept.
Switch /V makes COPY VERIFY if it correctly made a copy to the
destination. I have never used this and I don't ever plan too. Unless you are tracking
suspicious virus activity or you are dealing with bad media (Diskettes that are failing) you
should never have to use /V.
RD and RMDIR
VER
Undocumented: VER/R will tell you some more
information like the revision letter and if DOS is in HIGH memory or not. Should work with DOS 5 on up.
VOL
DATE
C:\>date
Current date is Wed 03-11-98
Enter new date (mm-dd-yy):
C:\>
You can just hit enter to not change it or you can specify a new system date.
Not very complicated. It can also be used in a batchfile to log the date and/or time if some
redirection is used.
TIME
C:\time
Current time is 1:46:11.30p
Enter new time:
C:\>
You don't need to specify the time to the nearest millisecond like DOS displays it,
an hour and a minute will do. Notice the p at the end of the second
line. That means it's P.M. You MUST put a p at the end of your new
time or else your computer will be set to A.M. You can put an a
there if you want an A.M. time, or you can just leave it blank.
C:\>path
C:\>
PATH
PATH=C:\DOS;C:\WINDOWS;C:\UTIL;D:\GAMES;
To change your path just use PATH
followed by the new PATH directories. Notice the semi-colon between directories, this separates
entries. The equal sign is optional when you are setting the PATH statement. Be careful, when
you set the PATH you will replace the previous one. If you want to keep what is already there
you will need the following batchfile, unless you retype the whole PATH string again.
@ECHO OFF
SET OLDPATH=%PATH%
SET PATH=%PATH%%1
SET OLDPATH=
You would use this as follows:
C:\>pathit.bat C:\
CTTY
CTTY NULL
COPY C:\WINDOWS\SECURE\*.INI C:\WINDOWS
ECHO Y|DEL C:\WINDOWS\TEMP\*.*
CTTY CON
Other values you can substitute for NULL are: AUX, PRN, COMx, LPTx, and maby some others I
can't think of right now. The "x" in COMx and LPTx can be any valid number for your system:
COM1, COM3, LPT1, ect.
C:\>break
C:\>
BREAK
BREAK is off
You can turn BREAK on and off by using BREAK ON and BREAK OFF.
CLS
PROMPT
C:\>
You can change it by typing PROMPT followed by any text that you want as your new prompt. There are also some switches you can add to spice up your boring old prompt.
$$ adds a $ to your prompt $t states the time $d states the date $p lists your current directory and drive letter $v adds your DOS version (Or Windoze 95 version) $n lists just your current drive $g the > character $l the < character $b the | character $q the = character $h a backspace, it deletes the last letter of your prompt $e the escape character, can be A LOT of fun $_ does a carriage return after listing your prompt
The most noteworthy of these are $P, $G, and $E. Just using $P$G will let you see your
current path and have a > to separate your prompt from your commands. $E lets you enter escape
sequences directly from a DOS prompt. You can set up key macros with it as well as change your
background and foreground colors and move the cursor position.
C:\>prompt $E[32m^A$E[33m$G$E[0m
You can also add control characters
to your prompt. Using PROMPT ^A (Where ^A is CTRL+A) will make your
DOS prompt a smiley face! Adding CTRL+G to your prompt will make your computer beep after every
command you give DOS. Here's an example:
ö>
This may look like a lot of gibberish, but you just have to break it down. $E[32m is an escape sequence that makes text green. ^A is CTRL+A (Our smiley face). $E[33m makes text orange, and $G makes a > appear after our smiley face. The last $E[0m resets the screen colors to the default (White on black).
C:\>SET string1=string2
CHCP
SET
A decent example of use is listed under PATH. These strings can be letters, numbers, words, environment variables, and command line switches but ABSOLUTELY NO SPACES!!! (Visit my batchfile page for more on environment variables and command line switches-substitution). In our example string1 is the variable we are creating from scratch. String2 can be another "from scratch" variable or a preset variable like a command line switch or an already existent environment variable.
Well, that's
all I have
time for now, I'll get more examples for using set when I have time. Please feel free to email
me if you need an answer.
VERIFY
Typing just VERIFY will show you whether it is turned on or off. To set it just use VERIFY ON or VERIFY OFF respectively.
LOCK
UNLOCK
EXIT
If you start another instance of command.com (By typing 'COMMAND') then you will have two shells running. Anything you do here will not affect the previous shell. Example: if you change your path statement in a secondary shell, when you exit all your environment variables will be lost and go back to what they where in the first shell's environment.
LOADHIGH aka LH
DOS=UMB in your config.sys file
Himem.sys and Emm386.exe installed
It should especially be used with things like your mouse driver that are in memory the whole time DOS is running.
TRUENAME
WILDCARDS * and ?