The World of DOS -
Creating Batch Files
Introduction(1)
History(1)
DOS/Win3.11/95/98 vs.
NT/ME/XP/2000(1)
Command Index(1)
Navigating DOS(2)
Tips and Tricks(2)
Network/Harware
Utilities(3)
How to make and use
bootable floppy disks(3)
Batch Files(4)
Creating Batch
Files(4)
Batch file utilities
and commands(4)
BREAK
CALL CHOICE CLS
ECHO EXIT FOR
GOTO IF LASTDRIVE
MSCDEX PAUSE REM
SET
The AUTOEXEC.BAT
file(4) autoexec.nt config.sys
Types of Batch and
System Files(4)
Parameters in batch
files(4)
Batch File Library(5)
Subject Index(5)
Helpful DOS Links(5)
Batch Files
What are batch files?
Batch files are not programs, pre se, they are lists of command line
instructions that are batched together in one file. For the most part, you
could manually type in the lines of a batch file and get the same results, but
batch files make this work easy. Batch files do not contain
"compiled" code like C++ so they can be opened, copied and edited.
They are usually used for simple routines and low-level machine instruction,
but they can be very powerful. If you look in your C:\, C:\WINDOWS, or C:\WINNT
folder you will see a multitude of .BAT, .SYS, .CFG, .INF and other types.
These are all kinds of batch files. This may shock you, but while most
applications are writen in Basic or C++ they sit on a mountain of batch files.
Batch files are the backbone of the Windows operating system, delete them and
you've effectively disabled the OS. There is a reason for this. The system
batch files on each computer are unique the that computer and change each time
a program is loaded. The operating system must have access to these files and
be able to add and delete instructions from them.
Creating Batch files
Simple instructions
Open a text editor like
notepad(NOT word or wordpad)
Type or copy this
text: @ECHO OFF
ECHO.
ECHO This is a batch
file
ECHO.
PAUSE
CLS
EXIT
Save this as
batchfile.bat, make sure there is no .txt extension after the .bat
Double-click the file
icon
This is a little
batch file I wrote that I use every day. It deletes the cookies that get dumped
to my hard drive every time I go online. I could set my browser preferences not
to accept cookies, but sometimes cookies are useful. Some CGI pages are unusable
with cookies, sometimes when you enter a password for a Website, the site uses
a cookie to remember your password. I just do not need hundreds of cookie files
taking up space after I close my browser. With this batch file, all I have to
do is double-click it and it deletes my cookies. Feel free to cut and paste
this code to your Notepad or Wordpad. Save it as cookiekill.bat on your
Desktop.
cls
REM
*******************************************
REM **Cookie Kill
Program Will not work in NT**
REM *******************************************
deltree /y
c:\windows\cookies\*.*
deltree /y
c:\windows\tempor~1\*.*
pause
cls
REM Cookies deleted!
What does the batch
file do? The first line has the command cls. cls clears the screen window of
any previous data. The next three lines start with REM for "remark."
Lines begining with REM do not contain commands, but instructions or messages
that will be displayed for the user. The next two lines begin with the command
deltree, deltree not only deletes files but directories and sub-directories. In
this case the file is deleting the directory cookies and all the files inside.
This directory is automatically rebuilt. The deltree has been passed the
parameter /y, this informs the process to answer "YES" to any
confirmation questions. Sometimes you type the DEL or one of its cousins, the
system will ask "Are sure you want to do this?" setting /y answers
these prompts without interupting the process. The pause command halts the
process temporarily and shows the users a list of all the files being deleted.
cls clears the screen again, another REM line tells the user that the files are
deleted. The last line contains only :end and returns the process to the
command prompt. This version was created to show the user everything that is
taking place in the process. The version bellow does the same thing without
showing the user any details.
cls
@echo off
deltree /y
c:\windows\cookies\*.*
deltree /y
c:\windows\tempor~1\*.*
cls
Without REM lines
there are no comments. The @echo off command keeps the process from being
"echoed" in the DOS window, and without the pause and :end lines, the
process runs and exits without prompting the user. In a process this small it
is okay to have it be invisible to the user. With more a complex process, more
visual feedback is needed. In computing there is fine line between too much and
too little information. When in doubt give the user the oportunity to see what
is going on.
This version is a little
more thurough, deletes alot of junk cls
@ECHO OFF
ECHO.
***********************************
ECHO. ** Clean
Cookies and Temp Files **
ECHO. ** Will not
work in NT **
ECHO.
*******************************
deltree /y
c:\windows\cookies\*.*
deltree /y c:\windows\tempor~1\*.*
deltree /y
c:\progra~1\Netscape\Users\default\Cache\*.jpg
deltree /y
c:\progra~1\Netscape\Users\default\Cache\*.gif
deltree /y
c:\progra~1\Netscape\Users\default\Cache\*.htm
deltree /y
c:\progra~1\Netscape\Users\default\archive\*.htm
deltree /y
c:\progra~1\Netscape\Users\default\archive\*.gif
deltree /y
c:\progra~1\Netscape\Users\default\archive\*.jpg
deltree /y
c:\windows\temp\*.*
deltree /y
c:\temp\*.*
deltree /y
c:\windows\Recent\*.*
deltree /y
c:\recycled\*.*
cls
EXIT
"C:\windows\history\today"
will rebuld itself if you delete it. It's not a file, it's a specially
configured directory structure that DOS doesn't see the same way that windows
does. C:\windows\history\today doesn't actually exist as DOS sees it. Go into
the C:\windows\history directory and type DIR/A this will show you the hidden
directories and how they are named.
WINNT Version @ECHO
OFF
ECHO
**************************************************
ECHO ** DEL replaces
DELTREE, /Q replaces /Y **
ECHO **************************************************
del /Q
c:\docume~1\alluse~1\Cookies\*.*
REM Change alluse~1
in the above line to your userID
del /q
c:\winnt\temp\*.*
del /q c:\temp\*.*
del /q
c:\winnt\Recent\*.*
del /q c:\*.chk
EXIT
Add these lines for
XP - Provided by Patrick R. del /q C:\Windows\Temp\Adware\*.*
del /q
C:\Windows\Temp\History\*.*
del /q
C:\Windows\Temp\Tempor~1\*.*
del /q
C:\Windows\Temp\Cookies\*.*
One thing I do quite
often is erase old floppy disks. I might have a stack of them and I don't care
what's on them, but I want all the files gone including potential
virii(everyone says "viruses" but "virii" is the proper
term. Snob!). But I get tired of opening a DOS prompt and typing in the command
to format the disk. So I wrote a one line batch file that does it for me. Save
it as: "disk_wipe.bat"
format a: /u
Put a disk in the
drive and double-click the .bat file icon.
Batch File Utilities
and Commands
Any valid DOS command
may be placed in a batch file, these commands are for setting-up the structure
and flow of a batch file.
CLS
Clears the screen
EXIT
Exits the
command-line process when the batch file terminatesEXIT
BREAK
When turned on, batch
file will stop if the user presses < Ctrl >-< Break > when turned
off, the script will continue until done.BREAK=ON
BREAK=OFF
CALL
Calls another batch
file and then returns control to the first when done.CALL
C:\WINDOWS\NEW_BATCHFILE.BAT
Call another
programCALL C:\calc.exe
Details.
CHOICE
Allows user input.
Default is Y or N.
You may make your own
choice with the /C: switch. This batch file displays a menu of three options.
Entering 1, 2 or 3 will display a different row of symbols. Take note that the
IF ERRORLEVEL statements must be listed in the reverse order of the selection.
CHOICE is not recognized in some versions of NT. @ECHO OFF
ECHO 1 - Stars
ECHO 2 - Dollar Signs
ECHO 3 - Crosses
CHOICE /C:123
IF errorlevel 3 goto
CRS
IF errorlevel 2 goto
DLR
IF errorlevel 1 goto
STR
:STR
ECHO
*******************
ECHO.
PAUSE
CLS
EXIT
:DLR
ECHO
$$$$$$$$$$$$$$$$$$$$
ECHO.
PAUSE
CLS
EXIT
:CRS
ECHO
+++++++++++++++++++++
ECHO.
PAUSE
CLS
EXIT
FOR...IN...DO
Runs a specified
command for each file in a set of files. FOR %%dosvar IN (set of items) DO
command or command strcuture.
%%dosvar is the
variable that will hold items in the list, usually a single leter: %%a or %%b.
Case sensitive, %%a is different from %A. The items in the (set) are assigned
to this variable each time the loop runs.
(set of items) is one
item or multiple items seperated by commas that determine how many times the
loop runs.
command or command
strcuture is the operation you want to perform for each item in the list.
This code will run
through the set (A, B, C), when it gets to B it will print the message: "B
is in the set!"FOR %%b in (A, B, C) DO IF %%b == B echo B is in the set!
This line will print
the contents of C:\windows\desktopFOR %%c in (C:\windows\desktop\*.*) DO echo
%%c
So, you may create
your own list or use various objects like files to determine the loop run.
Details.
GOTO
To go to a different
section in a batch file. You may create different sections by preceding the
name with a colon. :SUBSECTION
Programmers may find
this similar to funtions or sub-routines.
@ECHO OFF
:FIRSTSECTION
ECHO This is the
first section
PAUSE
GOTO SUBSECTION
:SUBSECTION
ECHO This is the
subsection
PAUSE
Skip sections of a
batch file@ECHO OFF
:ONE
ECHO This is ONE,
we'll skip TWO
PAUSE
GOTO THREE
:TWO
ECHO This is not
printed
:THREE
ECHO We skipped TWO!
PAUSE
GOTO END
:END
CLS
EXIT
Looping with
GOTO:BEGIN
REM Endless loop,
Help!!
GOTO BEGIN
Use with CHOICE
IF, IF EXIST, IF NOT
EXISTIF EXIST C:\tempfile.txt
DEL C:\tempfile.txt
IF NOT EXIST
C:\tempfile.txt
COPY
C:\WINDOWS\tempfile.txt C:\tempfile.txt
Use with
"errorlevel"
The generic paramater
errorlevel refers to the output another program or command and is also used
with the CHOICE structure. If you try and run a command in a batch file and
produces an error, you can use errorlevel to accept the returned code and take
some action. For example, let's say you have a batch file that deletes some
file. COPY C:\file.txt C:\file2.txt
If
"file.txt" doesn't exist, you will get the error: COULD NOT FIND
C:\FILE.TXT. Instead, use a structure like this to create the file, then copy
it by accepting the error.@ECHO OFF
:START
COPY file.txt
file2.txt
IF errorlevel 1 GOTO
MKFILE
GOTO :END
:MKFILE
ECHO file
text>file.txt
GOTO START
:END
ECHO Quitting
PAUSE
an errorlevel of 1
means there was an error, errorlevel of 0 means there was no error. You can see
these levels by adding this line after any line of commands: ECHO errorlevel:
%errorlevel%
Details.
PAUSE
Pauses until the user
hits a key.
This displays the
familiar "Press any key to continue..." message.
REM
Allows a remark to be
inserted in the batch script.
REM DIR C:\WINDOWS Not run as a command
DIR C:\WINDOWS Run as a command
ECHO
Setting ECHO
"on" will display the batch process to the screen, setting it to
"off" will hide the batch process.@ECHO OFF Commands are NOT displayed
@ECHO ON Commands are displayed
ECHO can also be used
in batch file to send output to the screen: @ECHO OFF
ECHO.
ECHO Hi, this is a
batch file
ECHO.
PAUSE
ECHO. sends a blank
line.
To echo special
characters, precede them with a caret:
ECHO ^<
ECHO ^>
Otherwise you will
get an error.
The @ before ECHO OFF
suppresses the display of the initial ECHO OFF command. Without the @ at the
beginning of a batch file the results of the ECHO OFF command will be
displayed. The @ can be placed before any DOS command to suppress the display.
Breaking long lines
of code
You may break up long
lines of code with the caret ^. Put it at the end of a line, the next line must
have space at the begining. Example: copy file.txt file2.txt
would be: copy
file.txt^
file2.txt
SET
Use to view or modify
environment variables. More.
LASTDRIVE
Sets the last drive
in the system.lastdrive=Q
MSCDEX
Loads the CD-ROM
software extensions(drivers), usually so an operating system can be then loaded
from CD. See the AUTOEXEC.BAT section for special instructions concerning CD
ROM installation. Installing windows from a CD when the CDROM is not yet
configured
The AUTOEXEC.BAT file
AUTOEXEC.BAT stands
for automatic execution batch file, as in start-up automatically when the
computer is turned on. Once a very important part of the operating system, it
is being less used and is slowly disapearing from Windows. It is still powerful
and useful. In NT versions it is called AUTOEXEC.NT, click here for more
information.
Before the graphical
user interface(GUI, "gooey") of Windows, turning on a PC would
display an enegmatic C:\> and not much else. Most computer users used the
same programs over-and-over, or only one program at all. DOS had a batch file
which set certain system environments on boot-up. Because this was a batch
file, it was possible to edit it and add a line to start-up the user's programs
automatically.
When the first
version of Windows was released users would turn their PCs on, and then type:
WIN or WINDOWS at the prompt invoking the Windows interface. The next version
of Windows added a line to the AUTOEXEC to start Windows right away. Exiting from
Windows, brought one to the DOS prompt. This automatic invocation of Windows
made a lot of people mad. Anyone who knew how to edit batch files would remove
that line from the AUTOEXEC to keep Windows from controling the Computer. Most
users do not even know that DOS is there now and have never seen it as Windows
hides the any scrolling DOS script with their fluffy-cloud screen. At work I
will often have to troubleshoot a PC by openning a DOS shell, the user's often
panic, believing that I have broken their machine because the screen
"turns black".
Most current versions
of Windows have a folder called "Start-up." Any program or shortcut
to a program placed in this folder will start automatically when the computer
is turned on. This is much easier for most users to handle than editing batch
files.
Old versions of DOS
had a AUTOEXEC that looked like this:
@echo off
prompt $p$g
All this really did
way set the DOS prompt to ">"
Later versions looked
like this:cls
@echo off
path
c:\dos;c:\windows
set temp=c:\temp
Lh mouse
Lh doskey
Lh mode LPT1 retry
This AUTOEXEC.BAT
loads DOS & then Windows. Sets up a "temp" directory. Loads the
mouse driver, sets DOSKEY as the default and sets the printer retry mode.
"Lh" stands for Load High, as in high memory.
An AUTOEXEC.BAT from
a Windows 3.11 Machine@ECHO On
rem
C:\WINDOWS\SMARTDRV.EXE
C:\WINDOWS\SMARTDRV.EXE
2038 512
PROMPT $p$g
PATH
C:\DOS;C:\WINDOWS;C:\LWORKS;C:\EXPLORER.4LC
SET TEMP=C:\DOS
MODE LPT1:,,P >nul
C:\DOS\SHARE.EXE
/F:150 /L:1500
C:\WINDOWS\mouse.COM
/Y
cd windows
WIN
This version simply
sets DOS to boot to Windows.
SET HOMEDRIVE=C:
SET HOMEPATH=\WINDOWS
Whenever a program is
installed on a computer, the setup program or wizard will often edit the
AUTOEXEC. Many developer studios will have to "set a path" so
programs can be compiled or run from any folder. This AUTOEXEC is an example of
that: SET PATH=C:\FSC\PCOBOL32;C:\SPRY\BIN
SET
PATH=C:\Cafe\BIN;C:\Cafe\JAVA\BIN;%PATH%
SET HOMEDRIVE=C:
SET HOMEPATH=\WINDOWS
This AUTOEXEC sets
the path for COBOL and JAVA development BINs. This way, the computer knows
where to look for associated files for COBOL and JAVA files if they are not
located directly in a BIN folder.
Sets all the devices
and boots to Windows.
When the
"REM" tags are removed the device commands become visible. @SET
PATH=C:C:\PROGRA~1\MICROS~1\OFFICE;%PATH%
REM [Header]
@ECHO ON
REM [CD-ROM Drive]
REM MSCDEX.EXE
/D:OEMCD001 /L:Z
REM [Display]
REM MODE CON: COLS=80
LINES=25
REM [Sound, MIDI, or
Video Capture Card]
REM SOUNDTST.COM
REM [Mouse]
REM MOUSE.COM
REM [Miscellaneous]
REM FACTORY.COM
For loading Windows
from a CD @echo off
MSCDEX.EXE
/D:OEMCD001 /L:D
d:
cd \win95
oemsetup /k
"a:\drvcopy.inf"
For loading CDROM
drivers
Removing the
"REM" tags uncomments the commands and runs them.REM MSCDEX.EXE
/D:OEMCD001 /l:d
REM MOUSE.EXE
AUTOEXEC in NT
NT does not use
AUTOEXEC.BAT, the file is called AUTOEXEC.NT and should be found in the
C:\WINNT\system32 folder. Here is a sample AUTOEXEC.NT file:@echo off
REM AUTOEXEC.BAT is
not used to initialize the MS-DOS environment.
REM AUTOEXEC.NT is
used to initialize the MS-DOS environment unless a
REM different startup
file is specified in an application's PIF.
REM Install CD ROM
extensions
lh
%SystemRoot%\system32\mscdexnt.exe
REM Install network
redirector (load before dosx.exe)
lh
%SystemRoot%\system32\redir
REM Install DPMI
support
lh
%SystemRoot%\system32\dosx
SET PCSA=C:\PW32
dnp16.exe
*.NT and *.CMD
.NT and .CMD may be
used as .BAT files were used in earlier versions of Windows. You may notice on
NT systems that there are fewer and fewer .BAT files. Try seaching for .NT or
.CMD and you will find many of the same types of batch files that were
available as .BATs. For example: CONFIG.NT has a similar function to the old
CONFIG.SYS of Windows.
CONFIG.SYS
In Windows systems
config.sys is used to set the initial values of the environment variables. To
see your current settings, type SET on a command line. In early versions
config.sys is a text file you can edit. In later versions it is a complied file
that cannot be changed in a text editor. In newer NT versions it is not used at
all. Try msconfig.exe instead. REM [Header]
FILES=20
BUFFERS=20
DOS=HIGH,UMB
REM [SCSI
Controllers]
REM DEVICE=SCSI.SYS
REM [CD-ROM Drive]
REM DEVICE=CDROM.SYS
/D:OEMCD001
REM [Display]
REM
DEVICE=DISPLAY.SYS
REM [Sound, MIDI, or
Video Capture Card]
REM DEVICE=SOUND.SYS
REM [Mouse]
REM DEVICE=MOUSE.SYS
REM
------------------
REM [Miscellaneous]
REM
DEVICE=SMARTDRV.EXE
Types of
"batch" files in windows
INI, *.ini -
Initalization file. These set the default variables for the system and
programs. More
CFG, *.cfg -
Configuration files.
SYS, *.sys - System
files, can sometimes be edited, mostly compiled machine code in new versions.
More.
COM, *.com - Command
files. These are the executable files for all the DOS commands. In early
versions there was a seperate file for each command. Now, most are inside
COMMAND.COM.
NT, *.nt - Batch
files used by NT operating systems. More.
CDM, *.cmd - Batch
files used in NT operating systems. More.
Answer Files and
Unattended Installations
Customizing Unattended
Installations
Answer Files
Customizing and
Automating Installations
Automate Windows
Installations
Batch File Parameters
You may put and use
command-line parameters into your batch-files.
Suppose you had a
batchfile called "test.bat" and these were the contents:@echo off
if (%1) == (Hi) echo
%1
and at the command
line you entered: test.bat Hi, the output would be "Hi". If you
entered test.bat bye you would get no response because the parameter did not
match. the "%1" refers to the first parameter on the command line
after the batch file name. If you want to two parameters, the script would look
like this:@echo off
if (%1) == (Hi) echo
%1 %2
You could also just
spit out what someone types in without a condition:
@echo off
echo %1 %2 %3 %4 %5
%6
Then typing test.bat
dont tell me what to do would produce
dont tell me what to
do because it is set up to handle 6 parameters and there are six words. You can
tease someone by changing the order:@echo off
echo %6 %3 %1 %2 %5
%4
do me dont tell to
what
Making your own
variables
You may use the SET
command to create your own internal paramaters. This batch file:@echo off
set myvar=Hi Joe
echo %myvar% is myvar
Will print Hi Joe is
myvar. Notice a few important points. when we initialize myvar there are no %
around it. When we use it, it must be between two %. Also, there must be no
spaces between the = and the terms. When myvar is not in a set command or
between % it is treated as a literal string.
You can make up your
own parameter names and have many of them:@echo off
set name=John Smith
set address=1 main
street
set city=helltown
echo %name%
echo %address%
echo %city%
You could also assign
command line parameters to the variables:@echo off
set name=%1
set address=%2
set city=%3
echo %name%
echo %address%
echo %city%
The command line
usually sees the space as a parameter delimiter, use double quotes " to
make it ingore the spaces: test.bat "Joe Smith" "1 Main
Street" "Helltown".
Something important
to remember about SET, it actaully creates a variable name in the file So if
you enter SET NAME=Joe on the command line or in a batch file and then go to
the command line and enter ECHO %NAME% the response will be Joe. Entering SET
with no parameters will also show the whole list of SET variables. These will
be erased when you reboot.
The power of command
line switches
Most GUI programs
have some kind of command line support which means you may automate their
operation through batch files. For example, DOS does not have a built-in email
sending function like UNIX. However, using an installed email program like
Outlook, you may "force feed" the program on the command line.
Outlook examples:outlook /c ipm.note will open a blank email, outlook /c
ipm.note /m msmith@yahoo.com will open a blank email with the indicated address,
outlook /c ipm.note /a myfile.doc attaches a file. More outlook switches,
outlook programming.
An example using
command line with winzip.
The Windows
Installation Catch-22
You have a new
computer with a unformated hard drive, or a drive with only DOS loaded. You
want to load Windows from a CD, but you can't see the CD ROM from the DOS
prompt. This is messy and can be screwed-up easily, luckily mistakes on this
don't cause permanent damage. If you're lucky the CD ROM you have came with an
installation disk(on floppy, of course). Putting this disk in and running the
INSTALL.EXE or SETUP.EXE will install the drivers for you and alter the system
files so you can load Windows from the CD ROM(Linux, by the way, has no problem
with this!). If there is no INSTALL.EXE on the disk, you will have to edit
lines in two files on your Windows 95 Boot/Install floppy disk. These files
are: CONFIG.SYS and AUTOEXEC.BAT. Open these files for editing are look for
lines that look like these:
REM DEVICE=CDROM.SYS
/D:OEMCD001
AndREM
C:\DOS\MSCDEX.EXE /D:OEMCD001
They may or may not
be REMed out. You will need to change the "/D:OEMCD001" part of these
lines to reflect the CD ROM that you have. For example if you have a Memorex it
might be "/D:MSCD001". But be sure, check any manuals you might have
lying around. If not, go to the manufacturer's website and down load the
installation files. You will also need to figure out which drive letter it will
be. If you only have on hard disk, it will be "D:" as in
"/D:MSCD001," if you have two hard drives, or your drive is in
several partitions, it might be "E:" or "F:". So then the
line would be "/E:MSCD001" or "/F:MSCD001"
The Final line in
CONFIG.SYS might be like this: DEVICE=C:\WINDOWS\SBIDE.SYS /D:MSCD001 /V
/P:170,15
olaf Main Index contact Concepts Programming Networking Hardware Operating Systems ||KnujOn
The World of DOS -
Network & Hardware Utilities, Boot Disks
Introduction(1)
History(1)
DOS/Win3.11/95/98 vs.
NT/ME/XP/2000(1)
Command Index(1)
Navigating DOS(2)
Tips and Tricks(2)
Network/Harware
Utilities(3)
How to make and use
bootable floppy disks(3)
XP & 2x
Rescue disks v. boot disks
Batch Files(4)
Creating Batch
Files(4)
Batch file utilities
and commands(4)
The AUTOEXEC.BAT
file(4)
Types of Batch and
System Files(4)
Parameters in batch
files(4)
Batch File Library(5)
Subject Index(5)
Helpful DOS Links(5)
DOS Network Utilities
If your PC is on a
network or you are connected to the Internet, you can use a number of DOS
Network utilities to check network connections, download files and communicate
with other machines.
PING
PING sends a number
of bytes(usually 32) to a specified machine in order to test the connection to
that machine and to reveal the hostname or IP address. For example, pinging
amazon.com would reveal their IP to be 208.216.182.15. You would do this by
entering: PING AMAZON.COM at the DOS prompt. Now, to check put 208.216.182.15
in your browser's location windows and hit <--ENTER--> and see what
happens.
TRACERT
To do the oposite of
PING use TRACERT with the switch "-h" to reveal the number of
"hops". Enter TRACERT -h 208.216.182.15 at the DOS prompt and hit
<--ENTER-->. This will not only show that the hostname for 208.216.182.15
is AMAZON.COM, but will also show every single host that you are routed through
to connect to AMAZON.COM.
TELNET
Typing TELNET at the
DOS prompt will open a TELNET session, allowing you to emulate a termial
connection with another computer. To learn more about TELNET click here.
FTP
FTP stands for File
Transfer Protocol. FTP is an old, fast way to move data from one machine to
another. To learn more about FTP click here.
FTP may be automated
in batch files but requires a seperate login script file. The problem is that
once DOS establishes an FTP connection, it's running in that shell and not the
batch file. What we have to do is call another file, a kind of log-in script,
once the FTP connection is established. This file should contain the username,
password and FTP commands were going to issue. Our batch file would look like
this: @ECHO OFF
FTP -s:login host.com
CSL
EXIT
-s: is a switch that
calls out login script, "login" would be the name of the script, but
could be called by another name. The contents of the script may look like
this:username
password
GET
pathname/filename.ext
DISCONNECT
QUIT
Just a simple list of
commands that might be typed in an FTP session, preferably in a file that has
no extension, that way no other programs attempt to open it when it is called
by FTP. The first two should be your username and password for the FTP service,
unless the FTP server permits anonymous connections. In this case the command
line would have to have -A after the FTP.
CACLS
Displays or modifies
access control lists (ACLs) of files. Similar to what can be done by
right-clicking the file and going to Properties, Security. You can see the
current security settings on a file or directoy by entering: CACLS filename or
directoryname.
Switches:
/T Changes ACLs of
specified files in the current directory and all subdirectories.
/E Edit ACL instead
of replacing it.
/C Continue on access
denied errors.
/G user:perm Grant
specified user access rights. perm = R Read, W Write, C Change, OR Full control
/R Revoke specified
user's access rights (only valid with /E).
/P user:perm Replace
specified user's access rights. perm = N None, R Read, W Write, C Change (write),
OR F Full control
/D Deny specified
user access.
General info on
Access Control Lists
ACLs on Windows NT
NETSTAT
NETSTAT will tell you
the current status of your network or internet connection. Entering NETSTAT at
the DOS prompt by itself will reveal the main host you are connected to.
Entering NETSTAT -A will reveal all the current TCP and UDP port activity on
your PC.
INTERLNK
Got two crapy old
PCs, can't afford to upgrade but you want to network them? In older versions of
DOS INTERLNK allowed two machines to be connected through a parallel or serial
cable.
INTERSVR
Starts the INTERLNK
service, allows one machine to behave like a server.
The NET family of
commands
All of these commands
start with "NET" followed by a space and the second command word. NET
by itself will display the definitions of the following second command words:
NET ACCOUNTS NT: Displays password rules for
current account
NET COMPUTER NT: Can only be used on a domain
controler. Adds or drops a computer from a network. Usage: NET COMPUTER
\\computername /add OR /del. Example: "NET COMPUTER \\node62 /add"
NET CONFIG Displays your current workgroup settings.
NET CONTINUE
NET DIAG Runs the Microsoft Network Diagnostics
program to display diagnostic information about your network.
NET FILE NT
NET GROUP NT
NET HELP Provides information about commands and
error messages.
NET HELPMSG NT: Provides more information for NT error
codes. Example: "NET HELPMSG 3001" will return information on error#
3001.
NET INIT Loads protocol and network-adapter
drivers without binding them to Protocol Manager.
NET LOCALGROUP NT
NET LOGOFF Breaks the connection between your computer
and the shared resources to which it is connected.
NET LOGON Identifies you as a member of a workgroup.
NET NAME NT
NET PASSWORD Changes your logon password.
NET PAUSE NT
NET PRINT Displays information about print queues
and controls print jobs.
NET SEND Sends a broadcast message to other
network machines. Syntax: NET SEND machine-name message-text Example: NET SEND
CLIENT10 Log-off, we're going to bring the server down! Quicker than email and
to the point. Will display over all other windows. NET SEND * message-text will
broadcast the message to every network machine.
NET SESSION NT
NET SHARE NT
NET START Starts services.
NET STATISTICS NT
NET STOP Stops services.
NET TIME Displays the time on or synchronizes
your computer's clock with the clock on a Microsoft Windows for Workgroups,
Windows NT, Windows 95, or NetWare time server.
NET USE Connects to or disconnects from a
shared resource or displays information about connections.
NET USER NT: Displays accounts on a node
NET VER Displays the type and version number
of the workgroup redirector you are using.
NET VIEW Displays a list of computers that share
resources or a list of shared resources on a specific computer.
These commands are
useful for several reasons:
1. You are running older, non-gui based
network software
2. You are running a hybrid network of Win
machines and other boxes
3. As the a client machine you may not have
normal access to this information(especially useful if your netadmin is an
idiot)
4. You are running command-line batches or
programs that need to run across the network and you don't have the time to
write a full gui-app.
IPCONFIG
ipconfig [/? | /all |
/release [adapter] | /renew [adapter] | /flushdns | /registerdns | /showclassid
adapter | /setclassid adapter [classidtoset] ] adapter Full name or pattern
with '*' and '?' to 'match', * matches any character, ? matches one character.
Options /all Display full configuration information. /release Release the IP
address for the specified adapter. /renew Renew the IP address for the
specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns
Refreshes all DHCP leases and re-registers DNS names /displaydns Display the
contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class
IDs allowed for adapter. /setclassid Modifies the dhcp class id. The default is
to display only the IP address, subnet mask and default gateway for each
adapter bound to TCP/IP. For Release and Renew, if no adapter name is
specified, then the IP address leases for all adapters bound to TCP/IP will be
released or renewed. For SetClassID, if no class id is specified, then the classid
is removed. Examples: > ipconfig ... Show information. > ipconfig /all
... Show detailed information > ipconfig /renew ... renew all adapaters >
ipconfig /renew EL* ... renew adapters named EL.... > ipconfig /release
*ELINK?21* ... release all matching adapters, eg. ELINK-21,
myELELINKi21adapter.
NSLOOKUP
NAME - print info
about the host/domain NAME using default server
NAME1 NAME2 - as
above, but use NAME2 as server
help or ? - print
info on common commands
set OPTION - set an
option
all - print options, current server and
host
[no]debug - print debugging information
[no]d2 - print exhaustive debugging
information
[no]defname - append domain name to each
query
[no]recurse - ask for recursive answer to
query
[no]search - use domain search list
[no]vc - always use a virtual circuit
domain=NAME - set default domain name to
NAME
srchlist=N1[/N2/.../N6] - set domain to N1
and search list to N1,N2, etc.
root=NAME - set root server to NAME
retry=X - set number of retries to X
timeout=X - set initial time-out interval
to X seconds
type=X - set query type (ex.
A,ANY,CNAME,MX,NS,PTR,SOA,SRV)
querytype=X - same as type
class=X - set query class (ex. IN
(Internet), ANY)
[no]msxfr - use MS fast zone transfer
ixfrver=X - current version to use in IXFR
transfer request
server NAME - set
default server to NAME, using current default server
lserver NAME - set
default server to NAME, using initial server
finger [USER] - finger
the optional NAME at the current default host
root - set current
default server to the root
ls [opt] DOMAIN [>
FILE] - list addresses in DOMAIN (optional: output to FILE)
-a - list canonical names and aliases
-d - list all records
-t TYPE - list records of the given type
(e.g. A,CNAME,MX,NS,PTR etc.)
view FILE - sort an
'ls' output file and view it with pg
exit - exit the
program
ROUTE
Manipulates network
routing tables.
ROUTE [-f] [-p]
[command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
-f Clears the routing
tables of all gateway entries. If this is used in conjunction with one of the
commands, the tables are cleared prior to running the command.
-p When used with the
ADD command, makes a route persistent across boots of the system. By default,
routes are not preserved when the system is restarted. Ignored for all other
commands, which always affect the appropriate persistent routes. This option is
not supported in Windows 95.
command One of these:
PRINT Prints a route
ADD Adds a route
DELETE Deletes a
route
CHANGE Modifies an
existing route
destination Specifies
the host.
MASK Specifies that
the next parameter is the 'netmask' value.
netmask Specifies a
subnet mask value for this route entry.
If not specified, it
defaults to 255.255.255.255.
gateway Specifies
gateway.
interface the
interface number for the specified route.
METRIC specifies the
metric, ie. cost for the destination.
All symbolic names
used for destination are looked up in the network database file NETWORKS. The
symbolic names for gateway are looked up in the host name database file HOSTS.
If the command is
PRINT or DELETE. Destination or gateway can be a wildcard, (wildcard is
specified as a star '*'), or the gateway argument may be omitted.
If Dest contains a *
or ?, it is treated as a shell pattern, and only matching destination routes
are printed. The '*' matches any string, and '?' matches any one char.
Examples: 157.*.1, 157.*, 127.*, *224*.
Diagnostic Notes:
Invalid MASK
generates an error, that is when (DEST & MASK) != DEST.
Example> route ADD
157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1 The route addition failed: The
specified mask parameter is invalid.
(Destination &
Mask) != Destination.
Examples:
> route PRINT
> route ADD
157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2
destination^ ^mask
^gateway metric^ ^
Interface^
If IF is not given,
it tries to find the best interface for a given gateway.
> route PRINT
> route PRINT 157*
.... Only prints those matching 157*
> route DELETE
157.0.0.0
> route PRINT
DOS PC/Hardware
Utilities
DOS comes equipped
with a number of very powerful utilities for analyzing and repairing harware
problems. If your Graphic User Interface operating system will not open or
boot, you may use these utilities to find and fix the problem.
SCANDISK
On older PCs this is
called "CHKDSK". If you are in doubt about what version of DOS you
are running or how old yor system is, type CHKDSK at the DOS prompt. any newer
version of DOS will tell you that CHKDSK is no longer availble and to use
SCANDISK instead. Enter SCANDISK C: and the program will open and begin
checking your hard drive for physical damage and will also examine the file
structure to find various errors. If the errors are not to serious, SCANDISK
will fix them for you.
MEM
MEM will tell you how
much memory(Random Operating Memory) you have and how much is being used. If
you have a program or a process that needs a minimum amount of RAM, use MEM to
check.
DEFRAG
Anytime you use SCANDISK,
you should use DEFRAG right afterwards. DEFRAG defragments your hard drive,
meaning it makes better use of the free space by putting all the used space
together in an order that makes data access easier. It's a lot like cleaing up
a cluttered closet. Enter DEFRAG C: at the DOS prompt and the program will
open. Often, the program will allow you to view the process.
FDISK
Warning! This is very
powerful tool and is usually used on new disks or disks that have been
recycled. FDISK creates partitions on a hard drive. After you use FDISK, the
drive should be formated or "SYSed".
Typing FDISK at the
DOS prompt will bring you to s a new command-line dialog:Current fixed disk
drive: 1
Choose one of the
following:
1. Create DOS
partition or Logical DOS Drive
2. Set Active
partition
3. Delete partition
or Logical DOS Drive
4. Display partition
information
Enter choice: [1]
Press ESC to exit
FDISK
Be careful not to
make any changes you don't want. Enter 4 to look at the present configuration.
You may get something like this, but it depends on your own disk:Partition Status Type Volume Label Mbytes System Usage
C: 1 A PRI
DOS 7545 FAT32 79%
SET
Displays, sets, or
removes Windows NT environment variables. Typing SET will reveal what all the
environment variables are set to. An
example:COMSPEC=C:\WINNT\SYSTEM32\COMMAND.COM
ALLUSERSPROFILE=C:\DOCUME~1\ALLUSE~1
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
OS2LIBPATH=C:\WINNT\system32\os2\dll;
PATH=C:\PW32;C:\WINNT\system32;
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86
Family 15 Model 2 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0207
PROGRAMFILES=C:\PROGRA~1
PROMPT=$P$G
SMS_LOCAL_DIR=C:\WINNT
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINNT
TEMP=C:\WINNT\TEMP
TMP=C:\WINNT\TEMP
Your variables may be
different depending on your PC model and what software is installed.
To change a variable
SET variable=new setting. Example: SET TEMP=C:\WINNT\NEWTEMP would change the
default temp directory to a folder called "NEWTEMP." This will change
back when you reboot, unless the change is made in the file where the variables
are set initially. This used to be simply in config.sys in older Windows
systems, but individual setting may be harder to find now. They could be
complied files, the AUTOEXEC, network scripts, etc.
SYS
Places a copy of the
operating system on the designated disk.
SYS C: A:, places the
OS on C: onto the floppy disk in A:. Not found on XP or 2000.
DBLSPACE.EXE
Compresses hard
drives to double the space. This enlarges the drive space but does not optimize
its use. This utility was more usefull in the days when storage space was
expensive and hard to come by. 10 Gigabyte hard drives for $100 have made this
utility obsolite.
Creating a Bootable
DOS Floppy Disk
Anyone who has or
works with a PC (any "IBM compatable", Windows system) should have a
Boot Disk. I keep one in my bag. They are easy to make and come in handy quite
often. Frankly, anyone who has a PC and doesn't have a boot disk is asking for
trouble.
First of all, what is
Booting?
Whenever a computer
is turned on it goes through a number of complex procedures. If you have a fast
computer, it will boot very quickly and you may not even notice what happens.
If you have a slower computer, you may catch glimpses of what takes place when
you power on. Early systems(and some newer, more complex ones) were booted
manually. A computer operator(a human) had to perfrom the functions of bootting
that we take for granted. The term comes from "pulling up oneself by the
bootstraps," an expression in itself archaic. Most computers come with a
BIOS chip. BIOS stands for Basic Input and Output System. BIOS is a low level
operating system that allows computers to perform simple functions before more
complex operating systems like Linux and Windows can be loaded. BIOS checks to
see if you have enough power to run the system. BIOS tests your memory(RAM,
SRAM, DRAM, Cache) by filling it with random data and then retreiving the data
to see if matches the data put in(if there is a mismatch there may be bad memory
chips, if there are no chips the system may not boot). BIOS tries to determine
all the devices atatched: keyboard, mouse, disk drives, CDROM, hard-drive,
modem, etc(if certain devices are not present, especially a keyboard there will
be serious problems in booting). If BIOS finds a hard-drive(fixed drive) it
tries to figure out what kind of operating system is loaded on the drive. If
there is no operating system on the HD or BIOS can not determine what is on the
HD, it will not boot to it.
When BIOS is happy
with everything, it turns the show over to the operating system on the
hard-drive. However, if your system does not boot, crashes when you boot or
does not find an operating system a boot disk will be needed. The standard BIOS
procedure is to check the floppy dirve for an operating system first(usually
A:\) then it checks the hard-drive. If there is a floppy(removable disk) in the
floppy drive with an operating system loaded, this will halt the BIOS process
of booting to the hard-drive. If there is a floppy disk in the drive that is
blank or has some other program on it, you will get a diskette error. If you
are having trouble booting to your hard-drive you will need to interrupt the
boot sequence to analyze the problem.
Making the disk
You will need:
A blank 3½ 1.44MB
floppy disk
Access to a PC with
DOS loaded
Windows 95/98/NT
Click the Start menu,
select Programs, click "MS-DOS prompt".
Windows 3.1 &
earlier
In the
"Main" window click on the "MS-DOS Prompt" icon.
You should now have a
DOS prompt.
Put your blank
disk(Warning! Everything will be erased on the disk if it's not blank!) in the
floppy drive, make sure the write protection is OFF(see the disk instructions
on the box if you don't know how to do this).
At the C:\WINDOWS>
or C:> prompt type FORMAT A:/S
This command will
format the disk in the A:\ drive with a copy of the operating system. The
switch /S specifies that the operating system should be added. FORMAT A: would
just format this disk as a blank disk that files could be saved on.
Now, type in DIR A:
at the DOS prompt or click on the floppy drive icon in "My Computer"
The following files
should now be on the disk:
msdos.sys
scandisk.ini
sys.com
scandisk.exe
format.com
command.com
chkdsk.exe
attrib.exe
drivespace.bin
debug.exe
config.sys
himem.sys
edit.com
ebd.sys
fdisk.exe
regedit.exe
scanundo.dat
io.sys
They may not all be
there or there may be more, depending on the DOS version. The most important
files are io.sys, himem.sys, msdos.sys, command.com, sys.com, edit.exe, regedit.exe,
and scandisk. With these programs you can work on a dead computer, as long as
it has a working floppy drive. With the disk still in the drive, power down
your PC and reboot it. The PC will now boot to the flopy disk with the A:\>
as your prompt.
Take the disk out of
the dive and turn the write-lock ON this will keep you from writing over this
disk and also keep you from getting a virus in the boot sector of the disk
where viruses often hide.
Boot disks in XP and
2x
For those of you who
have tried to run FORMAT A: /S in XP and 2000, you will notice that /S is not a
valid switch. If you do FORMAT/? you will see there is no switch that places
the DOS OS on a disk. The SYS command is also no longer available.
In Windows 2000 there
is a ultility on the original installation CD in the folder BOOTDISK. To create
one manually, use FORMAT A: /U. Find these files on your computer: NTDETECT.COM
and NTLDR.SYS and copy them to the disk. Also copy any other files you might
need like EDIT.COM or REGEDIT.EXE.
Creating a boot disk
for an NTFS or FAT partition
Creating a Boot Disk
for an NTFS or FAT Partition
Creating a Boot Disk
for an NTFS or FAT Partition
More boot disk
instructions
More boot disk
instructions, 2
Bootdisk.com - many
flavors
Rescue disks v. boot
disks
2000 and XP allow you
to create "rescue" disks. While I think it is a good idea to have a
resuce disk, it is not the same as a boot disk. A boot disk has a copy of the
low-level DOS operating system and allows you to access your harddrive without
loading the harddrive's operating system(without loading windows). A rescue
disk by-passes the normal windows boot sequence and goes to a special folder in
the system directory where backups of your pc configuration are kept.
olaf Main Index contact Concepts Programming Networking Hardware Operating Systems ||KnujOn
The World of DOS -
Network & Hardware Utilities, Boot Disks
Introduction(1)
History(1)
DOS/Win3.11/95/98 vs.
NT/ME/XP/2000(1)
Command Index(1)
Navigating DOS(2)
Tips and Tricks(2)
Network/Harware
Utilities(3)
How to make and use
bootable floppy disks(3)
XP & 2x
Rescue disks v. boot disks
Batch Files(4)
Creating Batch
Files(4)
Batch file utilities
and commands(4)
The AUTOEXEC.BAT
file(4)
Types of Batch and
System Files(4)
Parameters in batch
files(4)
Batch File Library(5)
Subject Index(5)
Helpful DOS Links(5)
DOS Network Utilities
If your PC is on a
network or you are connected to the Internet, you can use a number of DOS
Network utilities to check network connections, download files and communicate
with other machines.
PING
PING sends a number
of bytes(usually 32) to a specified machine in order to test the connection to
that machine and to reveal the hostname or IP address. For example, pinging
amazon.com would reveal their IP to be 208.216.182.15. You would do this by
entering: PING AMAZON.COM at the DOS prompt. Now, to check put 208.216.182.15
in your browser's location windows and hit <--ENTER--> and see what
happens.
TRACERT
To do the oposite of
PING use TRACERT with the switch "-h" to reveal the number of
"hops". Enter TRACERT -h 208.216.182.15 at the DOS prompt and hit
<--ENTER-->. This will not only show that the hostname for 208.216.182.15
is AMAZON.COM, but will also show every single host that you are routed through
to connect to AMAZON.COM.
TELNET
Typing TELNET at the
DOS prompt will open a TELNET session, allowing you to emulate a termial
connection with another computer. To learn more about TELNET click here.
FTP
FTP stands for File
Transfer Protocol. FTP is an old, fast way to move data from one machine to
another. To learn more about FTP click here.
FTP may be automated
in batch files but requires a seperate login script file. The problem is that
once DOS establishes an FTP connection, it's running in that shell and not the
batch file. What we have to do is call another file, a kind of log-in script,
once the FTP connection is established. This file should contain the username,
password and FTP commands were going to issue. Our batch file would look like
this: @ECHO OFF
FTP -s:login host.com
CSL
EXIT
-s: is a switch that
calls out login script, "login" would be the name of the script, but
could be called by another name. The contents of the script may look like
this:username
password
GET
pathname/filename.ext
DISCONNECT
QUIT
Just a simple list of
commands that might be typed in an FTP session, preferably in a file that has
no extension, that way no other programs attempt to open it when it is called
by FTP. The first two should be your username and password for the FTP service,
unless the FTP server permits anonymous connections. In this case the command
line would have to have -A after the FTP.
CACLS
Displays or modifies
access control lists (ACLs) of files. Similar to what can be done by
right-clicking the file and going to Properties, Security. You can see the
current security settings on a file or directoy by entering: CACLS filename or
directoryname.
Switches:
/T Changes ACLs of
specified files in the current directory and all subdirectories.
/E Edit ACL instead
of replacing it.
/C Continue on access
denied errors.
/G user:perm Grant
specified user access rights. perm = R Read, W Write, C Change, OR Full control
/R Revoke specified
user's access rights (only valid with /E).
/P user:perm Replace
specified user's access rights. perm = N None, R Read, W Write, C Change (write),
OR F Full control
/D Deny specified
user access.
General info on
Access Control Lists
ACLs on Windows NT
NETSTAT
NETSTAT will tell you
the current status of your network or internet connection. Entering NETSTAT at
the DOS prompt by itself will reveal the main host you are connected to.
Entering NETSTAT -A will reveal all the current TCP and UDP port activity on
your PC.
INTERLNK
Got two crapy old
PCs, can't afford to upgrade but you want to network them? In older versions of
DOS INTERLNK allowed two machines to be connected through a parallel or serial
cable.
INTERSVR
Starts the INTERLNK
service, allows one machine to behave like a server.
The NET family of
commands
All of these commands
start with "NET" followed by a space and the second command word. NET
by itself will display the definitions of the following second command words:
NET ACCOUNTS NT: Displays password rules for
current account
NET COMPUTER NT: Can only be used on a domain
controler. Adds or drops a computer from a network. Usage: NET COMPUTER
\\computername /add OR /del. Example: "NET COMPUTER \\node62 /add"
NET CONFIG Displays your current workgroup settings.
NET CONTINUE
NET DIAG Runs the Microsoft Network Diagnostics
program to display diagnostic information about your network.
NET FILE NT
NET GROUP NT
NET HELP Provides information about commands and
error messages.
NET HELPMSG NT: Provides more information for NT error
codes. Example: "NET HELPMSG 3001" will return information on error#
3001.
NET INIT Loads protocol and network-adapter
drivers without binding them to Protocol Manager.
NET LOCALGROUP NT
NET LOGOFF Breaks the connection between your computer
and the shared resources to which it is connected.
NET LOGON Identifies you as a member of a workgroup.
NET NAME NT
NET PASSWORD Changes your logon password.
NET PAUSE NT
NET PRINT Displays information about print queues
and controls print jobs.
NET SEND Sends a broadcast message to other
network machines. Syntax: NET SEND machine-name message-text Example: NET SEND
CLIENT10 Log-off, we're going to bring the server down! Quicker than email and
to the point. Will display over all other windows. NET SEND * message-text will
broadcast the message to every network machine.
NET SESSION NT
NET SHARE NT
NET START Starts services.
NET STATISTICS NT
NET STOP Stops services.
NET TIME Displays the time on or synchronizes
your computer's clock with the clock on a Microsoft Windows for Workgroups,
Windows NT, Windows 95, or NetWare time server.
NET USE Connects to or disconnects from a
shared resource or displays information about connections.
NET USER NT: Displays accounts on a node
NET VER Displays the type and version number
of the workgroup redirector you are using.
NET VIEW Displays a list of computers that share
resources or a list of shared resources on a specific computer.
These commands are
useful for several reasons:
1. You are running older, non-gui based
network software
2. You are running a hybrid network of Win
machines and other boxes
3. As the a client machine you may not have
normal access to this information(especially useful if your netadmin is an
idiot)
4. You are running command-line batches or
programs that need to run across the network and you don't have the time to write
a full gui-app.
IPCONFIG
ipconfig [/? | /all |
/release [adapter] | /renew [adapter] | /flushdns | /registerdns | /showclassid
adapter | /setclassid adapter [classidtoset] ] adapter Full name or pattern with
'*' and '?' to 'match', * matches any character, ? matches one character.
Options /all Display full configuration information. /release Release the IP
address for the specified adapter. /renew Renew the IP address for the
specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns
Refreshes all DHCP leases and re-registers DNS names /displaydns Display the
contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class
IDs allowed for adapter. /setclassid Modifies the dhcp class id. The default is
to display only the IP address, subnet mask and default gateway for each
adapter bound to TCP/IP. For Release and Renew, if no adapter name is
specified, then the IP address leases for all adapters bound to TCP/IP will be
released or renewed. For SetClassID, if no class id is specified, then the
classid is removed. Examples: > ipconfig ... Show information. > ipconfig
/all ... Show detailed information > ipconfig /renew ... renew all adapaters
> ipconfig /renew EL* ... renew adapters named EL.... > ipconfig /release
*ELINK?21* ... release all matching adapters, eg. ELINK-21,
myELELINKi21adapter.
NSLOOKUP
NAME - print info
about the host/domain NAME using default server
NAME1 NAME2 - as
above, but use NAME2 as server
help or ? - print info
on common commands
set OPTION - set an
option
all - print options, current server and
host
[no]debug - print debugging information
[no]d2 - print exhaustive debugging
information
[no]defname - append domain name to each
query
[no]recurse - ask for recursive answer to
query
[no]search - use domain search list
[no]vc - always use a virtual circuit
domain=NAME - set default domain name to
NAME
srchlist=N1[/N2/.../N6] - set domain to N1
and search list to N1,N2, etc.
root=NAME - set root server to NAME
retry=X - set number of retries to X
timeout=X - set initial time-out interval
to X seconds
type=X - set query type (ex.
A,ANY,CNAME,MX,NS,PTR,SOA,SRV)
querytype=X - same as type
class=X - set query class (ex. IN
(Internet), ANY)
[no]msxfr - use MS fast zone transfer
ixfrver=X - current version to use in IXFR
transfer request
server NAME - set
default server to NAME, using current default server
lserver NAME - set
default server to NAME, using initial server
finger [USER] -
finger the optional NAME at the current default host
root - set current
default server to the root
ls [opt] DOMAIN [>
FILE] - list addresses in DOMAIN (optional: output to FILE)
-a - list canonical names and aliases
-d - list all records
-t TYPE - list records of the given type
(e.g. A,CNAME,MX,NS,PTR etc.)
view FILE - sort an
'ls' output file and view it with pg
exit - exit the
program
ROUTE
Manipulates network
routing tables.
ROUTE [-f] [-p]
[command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
-f Clears the routing
tables of all gateway entries. If this is used in conjunction with one of the
commands, the tables are cleared prior to running the command.
-p When used with the
ADD command, makes a route persistent across boots of the system. By default,
routes are not preserved when the system is restarted. Ignored for all other
commands, which always affect the appropriate persistent routes. This option is
not supported in Windows 95.
command One of these:
PRINT Prints a route
ADD Adds a route
DELETE Deletes a
route
CHANGE Modifies an
existing route
destination Specifies
the host.
MASK Specifies that
the next parameter is the 'netmask' value.
netmask Specifies a
subnet mask value for this route entry.
If not specified, it
defaults to 255.255.255.255.
gateway Specifies
gateway.
interface the
interface number for the specified route.
METRIC specifies the
metric, ie. cost for the destination.
All symbolic names
used for destination are looked up in the network database file NETWORKS. The
symbolic names for gateway are looked up in the host name database file HOSTS.
If the command is
PRINT or DELETE. Destination or gateway can be a wildcard, (wildcard is
specified as a star '*'), or the gateway argument may be omitted.
If Dest contains a *
or ?, it is treated as a shell pattern, and only matching destination routes
are printed. The '*' matches any string, and '?' matches any one char.
Examples: 157.*.1, 157.*, 127.*, *224*.
Diagnostic Notes:
Invalid MASK
generates an error, that is when (DEST & MASK) != DEST.
Example> route ADD
157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1 The route addition failed: The
specified mask parameter is invalid.
(Destination &
Mask) != Destination.
Examples:
> route PRINT
> route ADD
157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2
destination^ ^mask
^gateway metric^ ^
Interface^
If IF is not given,
it tries to find the best interface for a given gateway.
> route PRINT
> route PRINT 157*
.... Only prints those matching 157*
> route DELETE
157.0.0.0
> route PRINT
DOS PC/Hardware
Utilities
DOS comes equipped
with a number of very powerful utilities for analyzing and repairing harware
problems. If your Graphic User Interface operating system will not open or
boot, you may use these utilities to find and fix the problem.
SCANDISK
On older PCs this is
called "CHKDSK". If you are in doubt about what version of DOS you
are running or how old yor system is, type CHKDSK at the DOS prompt. any newer
version of DOS will tell you that CHKDSK is no longer availble and to use
SCANDISK instead. Enter SCANDISK C: and the program will open and begin
checking your hard drive for physical damage and will also examine the file
structure to find various errors. If the errors are not to serious, SCANDISK
will fix them for you.
MEM
MEM will tell you how
much memory(Random Operating Memory) you have and how much is being used. If
you have a program or a process that needs a minimum amount of RAM, use MEM to
check.
DEFRAG
Anytime you use
SCANDISK, you should use DEFRAG right afterwards. DEFRAG defragments your hard
drive, meaning it makes better use of the free space by putting all the used
space together in an order that makes data access easier. It's a lot like
cleaing up a cluttered closet. Enter DEFRAG C: at the DOS prompt and the
program will open. Often, the program will allow you to view the process.
FDISK
Warning! This is very
powerful tool and is usually used on new disks or disks that have been
recycled. FDISK creates partitions on a hard drive. After you use FDISK, the
drive should be formated or "SYSed".
Typing FDISK at the
DOS prompt will bring you to s a new command-line dialog:Current fixed disk
drive: 1
Choose one of the
following:
1. Create DOS
partition or Logical DOS Drive
2. Set Active
partition
3. Delete partition
or Logical DOS Drive
4. Display partition
information
Enter choice: [1]
Press ESC to exit
FDISK
Be careful not to
make any changes you don't want. Enter 4 to look at the present configuration.
You may get something like this, but it depends on your own disk:Partition Status Type Volume Label Mbytes System Usage
C: 1 A PRI
DOS 7545 FAT32 79%
SET
Displays, sets, or
removes Windows NT environment variables. Typing SET will reveal what all the
environment variables are set to. An
example:COMSPEC=C:\WINNT\SYSTEM32\COMMAND.COM
ALLUSERSPROFILE=C:\DOCUME~1\ALLUSE~1
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
OS2LIBPATH=C:\WINNT\system32\os2\dll;
PATH=C:\PW32;C:\WINNT\system32;
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86
Family 15 Model 2 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0207
PROGRAMFILES=C:\PROGRA~1
PROMPT=$P$G
SMS_LOCAL_DIR=C:\WINNT
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINNT
TEMP=C:\WINNT\TEMP
TMP=C:\WINNT\TEMP
Your variables may be
different depending on your PC model and what software is installed.
To change a variable
SET variable=new setting. Example: SET TEMP=C:\WINNT\NEWTEMP would change the
default temp directory to a folder called "NEWTEMP." This will change
back when you reboot, unless the change is made in the file where the variables
are set initially. This used to be simply in config.sys in older Windows
systems, but individual setting may be harder to find now. They could be
complied files, the AUTOEXEC, network scripts, etc.
SYS
Places a copy of the
operating system on the designated disk.
SYS C: A:, places the
OS on C: onto the floppy disk in A:. Not found on XP or 2000.
DBLSPACE.EXE
Compresses hard
drives to double the space. This enlarges the drive space but does not optimize
its use. This utility was more usefull in the days when storage space was
expensive and hard to come by. 10 Gigabyte hard drives for $100 have made this
utility obsolite.
Creating a Bootable
DOS Floppy Disk
Anyone who has or
works with a PC (any "IBM compatable", Windows system) should have a
Boot Disk. I keep one in my bag. They are easy to make and come in handy quite
often. Frankly, anyone who has a PC and doesn't have a boot disk is asking for
trouble.
First of all, what is
Booting?
Whenever a computer
is turned on it goes through a number of complex procedures. If you have a fast
computer, it will boot very quickly and you may not even notice what happens.
If you have a slower computer, you may catch glimpses of what takes place when
you power on. Early systems(and some newer, more complex ones) were booted
manually. A computer operator(a human) had to perfrom the functions of bootting
that we take for granted. The term comes from "pulling up oneself by the
bootstraps," an expression in itself archaic. Most computers come with a
BIOS chip. BIOS stands for Basic Input and Output System. BIOS is a low level
operating system that allows computers to perform simple functions before more
complex operating systems like Linux and Windows can be loaded. BIOS checks to
see if you have enough power to run the system. BIOS tests your memory(RAM,
SRAM, DRAM, Cache) by filling it with random data and then retreiving the data
to see if matches the data put in(if there is a mismatch there may be bad
memory chips, if there are no chips the system may not boot). BIOS tries to
determine all the devices atatched: keyboard, mouse, disk drives, CDROM,
hard-drive, modem, etc(if certain devices are not present, especially a
keyboard there will be serious problems in booting). If BIOS finds a
hard-drive(fixed drive) it tries to figure out what kind of operating system is
loaded on the drive. If there is no operating system on the HD or BIOS can not
determine what is on the HD, it will not boot to it.
When BIOS is happy
with everything, it turns the show over to the operating system on the
hard-drive. However, if your system does not boot, crashes when you boot or
does not find an operating system a boot disk will be needed. The standard BIOS
procedure is to check the floppy dirve for an operating system first(usually
A:\) then it checks the hard-drive. If there is a floppy(removable disk) in the
floppy drive with an operating system loaded, this will halt the BIOS process
of booting to the hard-drive. If there is a floppy disk in the drive that is
blank or has some other program on it, you will get a diskette error. If you
are having trouble booting to your hard-drive you will need to interrupt the
boot sequence to analyze the problem.
Making the disk
You will need:
A blank 3½ 1.44MB
floppy disk
Access to a PC with
DOS loaded
Windows 95/98/NT
Click the Start menu,
select Programs, click "MS-DOS prompt".
Windows 3.1 &
earlier
In the
"Main" window click on the "MS-DOS Prompt" icon.
You should now have a
DOS prompt.
Put your blank
disk(Warning! Everything will be erased on the disk if it's not blank!) in the
floppy drive, make sure the write protection is OFF(see the disk instructions
on the box if you don't know how to do this).
At the C:\WINDOWS>
or C:> prompt type FORMAT A:/S
This command will
format the disk in the A:\ drive with a copy of the operating system. The
switch /S specifies that the operating system should be added. FORMAT A: would
just format this disk as a blank disk that files could be saved on.
Now, type in DIR A:
at the DOS prompt or click on the floppy drive icon in "My Computer"
The following files
should now be on the disk:
msdos.sys
scandisk.ini
sys.com
scandisk.exe
format.com
command.com
chkdsk.exe
attrib.exe
drivespace.bin
debug.exe
config.sys
himem.sys
edit.com
ebd.sys
fdisk.exe
regedit.exe
scanundo.dat
io.sys
They may not all be
there or there may be more, depending on the DOS version. The most important
files are io.sys, himem.sys, msdos.sys, command.com, sys.com, edit.exe,
regedit.exe, and scandisk. With these programs you can work on a dead computer,
as long as it has a working floppy drive. With the disk still in the drive,
power down your PC and reboot it. The PC will now boot to the flopy disk with
the A:\> as your prompt.
Take the disk out of
the dive and turn the write-lock ON this will keep you from writing over this
disk and also keep you from getting a virus in the boot sector of the disk
where viruses often hide.
Boot disks in XP and
2x
For those of you who have
tried to run FORMAT A: /S in XP and 2000, you will notice that /S is not a
valid switch. If you do FORMAT/? you will see there is no switch that places
the DOS OS on a disk. The SYS command is also no longer available.
In Windows 2000 there
is a ultility on the original installation CD in the folder BOOTDISK. To create
one manually, use FORMAT A: /U. Find these files on your computer: NTDETECT.COM
and NTLDR.SYS and copy them to the disk. Also copy any other files you might
need like EDIT.COM or REGEDIT.EXE.
Creating a boot disk
for an NTFS or FAT partition
Creating a Boot Disk
for an NTFS or FAT Partition
Creating a Boot Disk
for an NTFS or FAT Partition
More boot disk
instructions
More boot disk
instructions, 2
Bootdisk.com - many
flavors
Rescue disks v. boot
disks
2000 and XP allow you
to create "rescue" disks. While I think it is a good idea to have a
resuce disk, it is not the same as a boot disk. A boot disk has a copy of the
low-level DOS operating system and allows you to access your harddrive without
loading the harddrive's operating system(without loading windows). A rescue
disk by-passes the normal windows boot sequence and goes to a special folder in
the system directory where backups of your pc configuration are kept.
Windows 95/98: Start,
Programs, MS-DOS Prompt. OR Start, Run, and type "COMMAND"
Windows NT/XP/2K:
Start, Programs, MS-DOS Prompt. OR Start, Run, and type "CMD"
Now, a black window
should appear with prompt like this: "C:\WINDOWS>". If you are
using NT it will only say "C:\".
It should look like
this:
If the DOS window
fills up the whole screen, type EXIT, then right-click on the MS-DOS Icon,
click "Properties" and select the "Screen" tab, click on
"Window" instead of "Full-screen", click on "Ok"
and then reopen the DOS window.
Opening DOS in IBM's
OS/2
If you are using the
OS/2 platform, follow these instructions for opening a DOS session.
1. Open the
"OS/2 System" folder.
2. Open the
"Command Prompts" folder.
3. Click on the
"DOS Window" icon.
Open a command line
in NT/2x
Go to Start, Run,
type "COMMAND". In previous versions this was done by entering CMD.
In some versions of NT entering CMD may invoke previous versions of DOS. In
some versions of WIN2x, CMD will open a command line with spaces in the
directory name, COMMAND will open the window with the old 8 character limit.
NT/2x Directory
System
NT uses user
profiles. Each user will have different Desktop and My Documents folders under
different names. There is no directory called "Windows", but there is
one called "WINNT." Most NT system files will be found in
C:\WINNT\System or C:\WINNT\System32. In some cases %SystemRoot% is used to
address the system drive regardless of whether it is Windows or WINNT.
The different user
set-ups are in the C:\Documents and settings or C:\DOCUME~1. In this directory
there will be a different folder for each user who accesses the machine. You
may also see Administrator, Default User, All Users and some other funny
virtual user folders. Each folder will have its own Desktop, Start Menu, My
Documents, Cookies, Favorites and whatever directory structure the user has
made beneath. Programs everyone access are usually found in C:\program files or
C:\progra~1(same as Windows).
Navigating DOS
For those who have
never used a command line envornment, it can be a little confusing and
frustraiting. But don't worry. It's still confusing and frustraiting for people
who have been doing it for years. Start by using the DIR command.
DIR
At the C:\WINDOWS>
prompt type DIR for "directory". A list of files should fly up the
screen faster than you can read. When the prompt comes up again type DIR/P.
This will allow the list to be read one page at a time. Hit enter a few times
to get to the end of the list and back to the prompt. DIR is a program that
reads scans the current directory and lists all the files. /P is called a
switch. The P stands for "page" or "pause"(I can never find
out which). When you type DIR/P you are passing /P to the program DIR as a
Parameter. You can pass other parameters to DIR. Try typing DIR/W, this puts
the file list in "wide" format. Now try this, DIR R*.*. This will
display all the files that begin with the letter R. The "*.*" part of
the parameter is called a wildcard. A wildcard tells the program that anything
after the letter R does not matter. Try this one, DIR *.*EXE. This will display
all the files with the .EXE extension.
DIR will display all
the files, directories, file sizes, time and date or creation.
DIR|MORE will show
you the list and prompt to continue. Similar to DIR/P.
DIR/B for bare or
brief, shows only the filenames and their extensions.
8 Character Limits
In early systems
there was an 8 character limit on file names and directory names. Directory
names and file names also could not contain spaces. This scheme still plays a
big role in navigating DOS. The standard Windows folder "Program Files"
is called "PROGRA~1." The general rule is to count 6 characters in:
"PROGRA" then add the ~ and a number. Since we may have multiple
files or directories with similar names, we have numbers at the end of the 8
character name. The number is determined by which file or directory was created
first. Since Program Files is a built-in directory it gets a 1. If you create a
new directory called "Programs" the DOS name will be
"PROGRA~2". To view the DOS names, use this command: DIR/X
In some Windows
versions you can open a DOS prompt in specific directory by first navigating to
it through Windows Explorer, then going to Start, Run, CMD or COMMAND. In most
cases it will open the default PATH directory.
For a full list of
DIR possibilities enter DIR/? at the command prompt.
Switches
In DIR you placed
various slashes and letters after the commands. These are "switches"
that modify the behavior of a command. Every command has a different set of
switches. A "/A" may mean something for a command and something totally
different for another. Sometimes a switch may be preceded by a - instead of a
/, sometimes there is no special character at all. For each command look at the
help file to see the list of valid switches. You may view the help file of any
command by typing the command followed by /? or /HELP in older versions.
CD
Now for a different
command. Type in CD.. this should set the prompt to "C:\", meaning
that you are now in the root directory C:, C:\WINDOWS is a sub-directory of C:.
CD stands for "Change Directory", a program that allows you to move
around the directory structure. The .. parameter you passed to program CD tells
the program to move up one directory level. Now pass a different parameter,
type CD C:\WINDOWS\DESKTOP . This will change your directory level to the
Desktop folder. Type DIR/P and look at the file listing briefly. Now minimize
the DOS window and look at your Windows Desktop. You should see all the same
files. Most of the file extensions will be .LNK meaning that they are
shortcuts. CD will allow you navigate through the whole directory structure.
You may also look at floppy disks: CD A:(sometimes B: also), or CDROMs: CD
D:(sometimes E:).
CD.. puts you in the
parent directory(up one level)
CD. refers to the
current directory
As stated in the DIR
section there is an 8 character limit for directory names for many DOS systems.
When using CD to move to a directory with a long name be sure to know the DOS
name. Example:
CD progra~1 to go to
"program files" if you are in the root of C:\, otherwise use CD
C:\progra~1 from any other directory.
Using drive letters
as commands
To switch from one
drive to another simply type the drive letter. Example: D: or A:. For removable
media(floppy, CDROM) you must have the media in the drive to move to it.
PATH
PATH sets a directory
search order. This is useful in many respects. For example, if you are using a
boot disk you are running the DOS operating system from that disk and the more
complex commands will only run if you specify the location. If you are at the
A: prompt and want to run a command on C: you must type FIND C:\myfile to use
the FIND command, or if you are in C: you would need to type A:\FIND C:\myfile.
To make things easier, type PATH A:\ at the C:\ prompt. This way the operating
system will know to access A: for all the commands.
Some installation
programs(especially development environments) will add a line to the
AUTOEXEC.BAT like PATH=%PATH%;C:\MSSQL7\BINN this allows programming bins to be
accessed from anywhere on the drive.
DOSKEY
Type in DOSKEY at the
prompt, the DOSKEY program is now loaded. DOSKEY keeps a history of all the
commands you type in each session so you can reuse them without typing them in
over and over again. You may view your history by hitting the Up-arrow on your
keypad. DOSKEY is active in NT by default, but not in Win2K. Consitency is not
one of Microsoft's strong points.
DEL
DEL is the Delete
program in DOS. DEL allows you to delete files. For example, typing DEL
TEMP.TMP will delete the file temp.tmp. Warning! Using the DEL command in DOS
is not like deleting in Windows, there is no Recycle Bin, the files are gone.
If you accidentally delete systems files, you are going to have some problems.
Only delete files that you are sure about.
EDIT
At the command prompt
type EDIT. The screen should turn blue with a menu bar at the top. This is the
DOS EDIT program and it can come in handy. Click on the "File" menu
then click "Exit". You should be back at the prompt. With EDIT you
can view and alter just about any file on your system, even ones Windows will
not allow you to. Warning! Altering system or program files in EDIT can have
serious consequences. Make copies of any file you edit and work on the copy so
the original remains intact incase you screw up. Believe me, making copies is
much easier that reloading your operating system. This time EDIT TEST.TXT this
will open the editor and create a text file called "test.txt". Type
in some random text. For a moment stop using your mouse. Press <-Alt->
and then the Down-arrow on your key pad. This will dropdown the
"File" menu. This is how navigation was done before the mouse.
Learning how to use the keyboard for navigation can be useful something goes
wrong with your computer or your mouse wont work. Save your work and exit the
editor. In some early versions of DOS it was called "EDLIN." If EDIT
doesn't work try EDLIN instead.
REN
REN is short for
"rename" and is used to rename files. Warning! Renaming files is as
bad as deleting or altering them. Renaming system files can cause errors since
the files point to each other. Type in REN TEST.TXT TEST.DOC. This will rename
the text file you just created as an MSWord Document. You may now open Word and
edit the TEST file like any other Word file. Type REN TEST.DOC MYFILE.DOC. This
renames the file as "myfile" but it is still an MSWord document.
TYPE
TYPE is a program
that will show the contents of a file without opening it for editing. Try
entering TYPE MYFILE.DOC and you should see the contents of the file you
created earlier.
MORE
Earlier you learned
how to use the /p switch with the DIR command. There is another device which
allows you to view directories and file contents a page at a time: MORE. Use
the previous command to demonstrate. at the prompt enter TYPE MYFILE.DOC |MORE
and hit < enter >. If the file you selected it several pages long, DOS
will display the first page and then at the bottom of the screen you will see
--more--. DOS is waiting for you to continue. Hit < enter > and it will
scroll through the next page.
EXIT
Type this at the
prompt to close the current DOS session.
FIND
This is a very
usefull tool for searching files for strings(text). If you have lost a file or
renamed a file and cannot remember what the name was, you can use FIND to
locate it. For example if your name is Joe and the missing file has your name
in it, enter FIND "Joe" at the prompt. DOS will search the current
directory for any file containing the string "Joe."
MD or MKDIR
Use this to create
and name your own DOS/Windows directory.
MD test, creates a
directory named "test"
RD or RMDIR
Use this to remove directories.
RD test
MOVE
Moves files from one
location to another, as opposed to copying.
MOVE test.txt A:\,
moves the file "test.txt" from the current directory to the A: drive.
COPY
Copies files.COPY
C:\myfile.txt A:\myfile.txt
XCOPY
"Extended"
COPY. Copies files from one or more subdirectories. Slightly more powerful than
COPY. XCOPY has all the same functions as COPY but these switches also
available:
/D:m-d-y Copies files changed on or after the
specified date. If no date is given, copies only those files whose source time
is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings.
When any of the strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For example, specifying a
string like \obj\ or .obj will exclude all files underneath the directory obj
or all files with the .obj extension respectively.
/P Prompts you before creating each
destination file.
/S Copies directories and subdirectories
except empty ones.
/E Copies directories and subdirectories,
including empty ones. Same as /S /E. May be used to modify /T.
/W Prompts you to press a key before
copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying
more than one file, assumes that destination must be a directory.
/Q Does not display file names while
copying.
/F Displays full source and destination file
names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not
copy files. Does not include empty directories or subdirectories. /T /E
includes empty directories and subdirectories.
/U Copies only files that already exist in
destination.
/K Copies attributes. Normal Xcopy will
reset read-only attributes.
/O Copies file ownership and ACL
information.
/X Copies file audit settings (implies /O).
CLS
Clears the screen.
Clears previous output in the DOS window. Helps close out batch processes.
SET
Shows the environment
values and allows them to be changed. See more in Parameters
FORMAT
Formats a disk for
use
FORMAT A:
Genericaly formats a
disk for storage use. Most disks are sold pre-formated, nowadays, but the
version may not always be compatable with your operating system.
FORMAT B:
Formats a disk in the
B drive.
FORMAT A: /S
Places a copy of the
operating system on the disk so it is "bootable".
FORMAT A: /U
Totally erases disk,
regardless of what was on it before.
UNFORMAT
Recovers a formatted
disk.
LABEL
Use for labeling a
disk or changing the present label of a disk. To see what the current label is
use VOL
LABEL
A:MY_FAVORITE_DISK
ATTRIB
There are many
"hidden" files on your system. Some are hidden for a good reason,
they are system files that programmers did not want users to delete
accidentally. Deleting these files my make your computer inoperable. HOWEVER!
Hidden files may also be nasty virii or a corrupted file that is causing
problems in your computer. Maybe something you downloaded from the Internet is
popping-up all the time and causing your browser or system to crash. You look
for the file but it's not there, or it is there but you can't delete it:
"Access Denied." Access deined! It's my F!ng computer! Fear not my
friend! ATTRIB stands for file attributes. Files my be designated as hidden, archive,
system or read-only. There are only four and it's easy ro remember because it
might give you RASH. Open a DOS prompt and navigate to the C:\> root
directory. Type "DIR" and you will get a list of files and
directories. Type "ATTRIB" and you will get a similar list, but it is
much longer. Type "DIR IO.SYS" or "DIR MSDOS.SYS" and it
will probably result in this:File not found
Type in "ATTRIB
MSDOS.SYS" and you'll see this:A SHR MSDOS.SYS C:\MSDOS.SYS
Gee, all of the
sudden it's there?
This is interesting.
Go to the C:\WINDOWS\ directory and do an ATTRIB on a file called
"user.da0". This is hidden file that you should be aware of. Why?
Because inside is a tiny databse of everything you do. Every file you open,
every application you use, every website you visit. You cannot delete or rename
a hidden file. To change the attributes, use the following syntax:ATTRIB -R -A
-S -H USER.DA0
Now you may delete or
rename to your heart's content.
To turn attributes
on, let us say that you want to conceal files on your PC from the casual
snooper, or from the Boss. Use this syntax:ATTRIB +R +A +S +H filename
- will turn the
attributes off, + will turn them on.
DOSSHELL
A shell interface
that makes DOS easier to use. This is not part of most current versions of DOS
and would have to be loaded seperately.
KEYB and NLSFUNC
These are DOS
programs for international language support, they are not available on most PCs
sold in the U.S. and must be loaded specially. They are present in version sold
in other countries.
KEYB changes the
keyboard layout to match foreign keyboard designs. Last time I checked it
supported 18 languages. Paramaters of this command alter the configuration of
KEYBOARD.SYS.
NLSFUNC is used to
load a specific language file, usually COUNTRY.SYS.
Both of these
commands have been replaced by GUI programs.
More information
NUMLOCK
Sets the the NUM LOCK
on or off. Cannot be run from the command line, must be in a boot batch file
like CONFIG.SYS
PROMPT
Changing the DOS
prompt. The default DOS prompt is: diskletter:\directoryname>, example:
C:\WINDOWS>. But there are many other options available.
Enter PROMPT $p$g at
the command-line for the standard prompt.
Try these others:
PROMPT Sets it to
"C>"(which is the old pre-windows prompt)
PROMPT $t Makes the
current time(military) your prompt
PROMPT $d Makes the
current date your prompt
PROMPT $v Makes the
Windows Version your prompt
PROMPT $q Prompt is
"="
PROMPT $b Prompt is
"|"
PROMPT $e Prompt is
"<-"
PROMPT $l Prompt is
"<"
PROMPT $_ Prompt is
nothing(can be scary)
PROMPT $n Makes the
current drive letter your prompt
PROMPT $a Opens up a
whole host of options. For example, PROMPT $aHello Jerk makes the prompt: Hello
Jerk. You could have a user's name as the prompt: PROMPT $aTeddy Roosevelt.
Combinations are also possible: PROMPT $aGeorge $t makes the prompt a user's
name an the current time.
If you want a
particular prompt to be permanent, insert one of these lines into you AUTOEXEC.BAT
file.
Make your DOS prompt
look like the Lost hatch terminal:
PROMPT=$g:
COLOR=0a
OR
PROMPT=$g:$s4$s8$s15$s16$s23$s42
COLOR=0a> :
> : 4 8 15 16 23
42
More recent
DOS/Windows versions
$A =
&
$B = |
$C = (
$D =
Current date
$E = Left
arrow
$F = )
$G = >
$H =
Backspace
$L = <
$N =
Current drive
$P =
Current drive and path
$Q = =
$S =
space $T = Current time
$V =
Windows 2000 version number
$_ =
Carriage return and linefeed
$$ = $
More: 1, 2
TREE
Creates a graphic map
of directories and sub directories. For example, use a folder like
C:\WINDOWS\TEMP or C:\WINNT\TEMP so you wont be overwhelmed while testing it.
Typing TREE in this directory might produce: C:.
|-----ms
|-----sms
|-----logs
MS is a subdirectory
of TEMP, SMS is a subdirectory of MS, LOGS is a subdirectory or SMS.
TREE/F will show file
names in addition to directories.
To send the output to
text file: TREE/A>mymap.txt. The /A will use simple formatting that will
read better in the output file.
More
Tips, Tricks and
Other DOS topics
< Ctrl > C
To end a process that
is running in DOS, hit the control key, "< Ctrl >", and the
"C" key at the same time. This will end the process without closing
the session.
The DOS window has
taken over my screen!
If you are using any
version of Windows, type < Alt > and < Tab > at the same time. This
will toggle the DOS window into the Windows task bar. From there, right-click
on the DOS box in the taskbar and click on "Properties" then the
"Screen" tab. You should change the screen selection from
"Full-screen" to "Window."
DOS Devices and I/O
Redirection
What is redirection?
Typically output from DOS commands is displayed to the screen unless otherwise
specified. It is possible to send output to a file, a printer and other
devices. Devices are the ports on your PC where data move in and out of memory.
Your monitor port is a device, the keyboard and mouse are devices. Serial and
parallel ports where printers and other external components plug in are
devices. Forcing files to the printer:
TYPE filename>LPT1
LPT1 is the device
name for the printer port. It also may be PRN, LPT2, or LPT3
(This may only work
if your printer is directly attatched to you LPT port, it may not work on a
network)
The ">"
refers to the direction of the standard output.
TYPE
mydoc.txt>LPT1 will send the document right to the printer.
The above is
generally for local printers(meaning connected to the ports on the back of your
machine). If you are printing on a network, try using the location of the
printer with these commands. Example:
TYPE
filename>\\severname\printername
So if my printer
server was called "NETPRINT" and the printer was called
"HPLASER1", the line would be:
TYPE
myfile.txt>\\NETPRINT\HPLASER1
Forcing files to a
file:
TYPE
filename1>filename2
This will dynamicaly
move the contents of one file new file, creating and naming the new file at the
same time.
TYPE
mydoc.txt>mydoc.doc will create a new document called "mydoc.doc"
with the contents of "mydoc.txt"
You may also use
>> . The difference is that > will overwrite >> will append.
< Redirect input,
used with SORT.
More on SORT.
>&
<&
CRTL+P Copies all
subsequent input chars to printer
CRTL+S Suspend
further output to a device
CRTL+Z Marks end of a
file or stream
DOS Devices
AUX - Auxiliary
device, usually first serial port
CLOCK$ - Real-time
system clock
COM1 - COM4 - Serial
ports(asynchronous)
CON - Keyboard and
monitor
LPT1 - LPT4
NUL - The
"bit-bucket", discards output and provides no input.
PRN - First parallel
port, often a printer
The typical
difference between COM and LTP is that COM devices may go in two
directions(I/O) while LPT is usually only for output.
Why use NUL? Forcing
output to NUL ensures it is discarded. Programs usually have some kind of
output, generally displayed on the screen. program.exe > output.txt will
force the output to a file. program.exe > NUL will force the output to
"nowhere."
Print a directory
listing with LTP1
More Tips...
Windows Tips
Batch File
Programming: Stupid Useless Tricks
Coming under the
heading of the "Edison Effect": Thomas Edison could have been the
father of electronics when he discovered the electron cloud surrounding heated
filaments, but he dismissed it as merely a curiosity. We all bump into curious
items, but never pursue thier practical application...
Prefacing commands
with +
Also works with commas
and semicolons. Generally causes the command to treat it's last letter as it's
first argument. For example, +MD will create a directory named D. One exception
is echo. It treats the entire word as it's first argument.
N:\temp>dir
Volume in drive N is HDA1_BOOT
Volume Serial Number
is 32FF-2953
Directory of N:\temp
. <DIR> 04-17-97 3:24p .
.. <DIR>
04-17-97 3:24p ..
0 file(s) 0 bytes
2 dir(s) 2,215,936
bytes free
N:\temp>+md
N:\temp>dir
Volume in drive N is
HDA1_BOOT
Volume Serial Number
is 32FF-2953
Directory of N:\temp
. <DIR> 04-17-97 3:24p .
.. <DIR>
04-17-97 3:24p ..
D <DIR> 04-17-97 3:24p d
0 file(s) 0 bytes
3 dir(s) 2,215,424
bytes free
N:\temp>+echo
hello
echo hello
Display Windows
Revision
Use the undocumented
/R option on the VER command.
C:\>ver
Windows 95. [Version
4.00.950]
C:\>ver /r
Windows 95. [Version
4.00.950]
Revision A
DOS is in HMA
Display Error Levels
Use the undocumented
/Z option on COMMAND
N:\temp>command /z
Microsoft(R) Windows
95
(C)Copyright
Microsoft Corp 1981-1995.
Return code
(ERRORLEVEL): 0
WARNING: Reloaded
COMMAND.COM transient
N:\temp>echo
test|find "test">nul
Return code
(ERRORLEVEL): 0
N:\temp>echo
qwerty|find "test">nul
Return code
(ERRORLEVEL): 1
N:\temp> exit
N:\temp>
Change Floppy Serial
Numbers
Use DEBUG to change
data on the disk
This example shows
how to "turn off" the serial number display for the disk in the A:
drive. The digit shown in blue on the "E" command is the one that
toggles display of the serial number.
C:\>DEBUG
-L 0 0 0 1
-E 26 00
-W 0 0 0 1
-Q
C:\>DIR A:
Volume in drive A has
no label
Directory of A:\
This example shows
how to set the serial number for the disk in the A: drive to any value. Notice
the numbers you enter (in red) are mirrored from the serial number you'll get.
C:\>debug
-L 0 0 0 1
-E 26 29 78 56 34 12
-W 0 0 0 1
-Q
C:\>DIR A:
Volume in drive A has
no label
Volume Serial Number
is 1234-5678
Directory of A:\
Using MORE to
Concatenate
MORE is the only
command I know that accepts two input methods at once. While MORE is usually
used with piping or redirection, it can also be supplied with a filename. If
you supply both, MORE will "page" both , so you must be careful the
combined length will not exceed a page (or you'll be forced to press a key).
Notice with the sample files I generated below how MORE places a CR/LF pair at
the beginning of each file, but leaves the ends alone.
Generation of sample files used in this
example
E:\>copy con
now.txt
Now is the time
for all good men^Z
1 file(s) copied E:\>copy con to.txt
to come to the
aid
of their
country^Z
1 file(s) copied
Although my example
used
type now.txt|more
to.txt
the same results are
achieved with
more<now.txt
to.txt
Using ATTRIB to
Search for a File
ATTRIB with the /S
option will search all subdirectories for the designated files. This is much
faster than the method of using FIND on the output of DIR /S /B. In fact, it
runs about twice as fast as the Windows 95 "Find Files or Folders"
function. In addition, it always returns the short "8.3" filename.
Frustratingly, it also returns the short path appended to the long filename.
For example:
H:\>attrib /s
longf*.*
A
HR LONGFI~2.TXT H:\VB5\MSDEVE~1\Long File Name.txt
There is a temptation
to use ATTRIB as a long-to-short filename converter. Unfortunately, the
attributes do get displayed first. So you can't be sure what position your
filename will be in because you don't know how many attributes there are. Since
long file names can contain spaces, you can't just start at the end and work
backwards either. The good news is that ATTRIB sets errorlevels based on
whether or not it found files. So you can at least use it like a recursive IF
EXIST:
attrib /s
\somefile.txt
if not errorlevel 1
echo I found "somefile.txt" somewhere on the disk
Surviving Abort,
Retry, Fail
If you invoke the
undocumented /F option on COMMAND, it will automatically answer "F"
to any Abort, Retry, Fail? questions. This eliminates the fear of your program
hanging if you reference a floppy that isn't inserted. Although the questions
are answered automatically, they still appear on screen...
C:\WINDOWS>COMMAND
/F
Microsoft(R) Windows
95
(C)Copyright Microsoft Corp 1981-1995.
C:\WINDOWS>DIR A:
Not ready reading
drive A
Abort, Retry, Fail?
Not ready reading
drive A
Abort, Retry,
Fail?Volume in drive A has no label
Not ready reading
drive A
Abort, Retry,
Fail?Fail on INT 24
C:\WINDOWS>if
exist a:\nul echo hello
Not ready reading
drive A
Abort, Retry, Fail?
Not ready reading drive
?
Abort, Retry, Fail?
C:\WINDOWS> exit
C:\WINDOWS>
Redirection based on
IF EXIST
If you use IF EXIST
(or IF NOT EXIST) without the required command, you can specify a file for the
next command (prompt and all) to be redirected into. Notice the command gets
redirected, not the command's output. The redirection only occurs when the IF
condition is true and if echo is on. If the condition is false or echo is off,
a zero-byte file is generated instead. The bad news is that this only works on
Win95 and Win98.
echo on
@if exist nul >
test.txt
echo off
In the above example,
since NUL always exists, TEST.TXT will contain the string C:\>echo off.
Although nobody does it this way, this has obvious applications in capturing
prompts without launching a separate DOS shell:
@ctty nul
prompt set value$Q
echo on
if exist
nul>temp.bat
hello
echo off
prompt $p$g
ctty con
When the above file
is run, it will create a TEMP.BAT with the text set value=hello in it. The ctty
nul hides the Bad command or file name error that happens because
"hello" is not a valid command.
TRUENAME Simplifies
complex paths
Some batch programs
may arrive at a path by appending \.. to move around. Afterwards, it may not be
clear just where DOS thinks things are. The undocumented TRUENAME command will
resolve and simplify 8.3 names whether the files or directories they reference
exist or not. TRUENAME even sees through SUBST and JOIN (like anybody uses them
nowadays). In the examples below, all commands were entered from the E:\>
prompt. The responses all refer to the C: drive.
E:\>TRUENAME
C:\PROGRA~1\WINZIP\..\..\WINZIP\PROGRA~1\NUL
C:/NUL
E:\>TRUENAME
C:\PROGRA~1\WINZIP\..\..\WINZIP\PROGRA~1\README.TXT
C:\WINZIP\PROGRA~1\README.TXT
E:\>TRUENAME
C:\PROGRA~1\WINZIP\..\WINZIP\README.TXT
C:\PROGRA~1\WINZIP\README.TXT
The bad news is that
TRUENAME absolutely will not work with long file names. It simply truncates the
names until they fit in an 8.3 mask, and will happily give you the bogus name
as a result. The good news is that if you change into a directory, running
TRUENAME without arguments will give you the real legitimate short name of the
directory.
Instant Environment
Space
If you need to set
lots of environment variables, but you're not sure if there's going to be
enough space left for them, you're faced with a tough problem. You have to use
the /E option on SHELL in your CONFIG.SYS or with COMMAND to boost your
environment space beyond the standard 256 bytes. All well and good on your
machine. But if you write for others, maybe they already have a 1024 byte
environment. Normally, when you use COMMAND to launch another session, you get
a copy of the current environment. But there's an easy way to stop that! Run
COMMAND specifying the path for COMMAND.COM (you forgot about that option,
didn't you!). You don't have to specify a valid path, but you can if you want
to.
E:\>set
TMP=C:\WINDOWS\TEMP
TEMP=C:\WINDOWS\TEMP
PROMPT=$p$g
winbootdir=C:\WINDOWS
COMSPEC=C:\WINDOWS\COMMAND.COM
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\UTILS;
windir=C:\WINDOWS
E:\>command .
Specified COMMAND
search directory bad
Microsoft(R) Windows
95
(C)Copyright Microsoft Corp 1981-1995.
E>set
PATH=
E>exit
E:\>command
c:\windows
Microsoft(R) Windows
95
(C)Copyright Microsoft Corp 1981-1995.
E>set
PATH=
E>exit
E:\>
If you have a
heavy-duty batch file, you can call it this way:
command \ /c test.bat
Be careful using this
technique, because the entire environment is gone (until you exit). That means
no PATH. No access to any commands not in the current directory. You might want
to make a copy of the PATH before you jump into the clean session. Notice in
the example code below I used "noenvironment" as the command search
path. It makes it a little more self-documenting.
@echo off
echo Here is the
original environment:
set
echo @echo off >
test.bat
path >>
test.bat
echo echo. >>
test.bat
echo echo Here is the
clean environment: >> test.bat
echo set >>
test.bat
command noenvironment
/c test.bat
del test.bat
ECHOing the words ON
and OFF
Echo is often used to
create secondary batch files, Basic files, and user prompts. Very rarely,
you'll need to echo a line that starts with on or off. If so, you can expand on
a trick used to create blank lines. You probably already know that echo. (echo
followed by a period with no space between) will result in a blank line, but
did you know that you can substitute any of these five characters / \ [ ] +
instead of the period as well? It turns out that echo followed by any of those
six characters will result in echo treating on and off as simple words:
E:\>echo on error
goto done
ON
E:\>echo.on error
goto done
on error goto done
E:\>echo on
E:\>echo.on
on
E:\>echo off -
opposite of on
OFF
E:\>echo.off -
opposite of on
off - opposite of on
Running DOS 5 & 6
Under Windows 95
Now, this is the
stupidest thing you could ever want to do. The only time I ever do it is when I
want a quick test of some obsolete feature for a compatibility check. Otherwise
I reboot my machine (I love System Commander!) into the appropriate OS. Still,
to quote Douglas Adams, it's "Mostly harmless". You can see by the picture
that I am running 5 different versions of DOS simultaneously. Try not to do too
much unless you like seeing Incorrect DOS version on every other command. All
you need to do is copy and rename your command.com files ( I picked DOS500,
DOS600, etc.). Then use SETVER to put the new names in the version table, for
example
setver dos500.com
5.00
setver dos600.com
6.00
setver dos620.com
6.20
setver dos622.com
6.22
After you reboot,
you'll be able to use the old versions of DOS simultaneously just like I do.
Just don't try to run them from the command line or you'll lock up your DOS
window. Either double-click them with Explorer, put them in your Start Menu, or
use START from the command line to run them in a separate window.
Get Everything Before
Something Else
No, there is no
better way to describe it. If you have a string like 2:34:56.78p and you want
to take action based on everything before the first colon, you can do it
without parsing it character-by-character. The only restriction is that the
"colon" has to be one of these ten special characters: [ : ,
. / \
; + = ]
What you do is GOTO to a label in your program and use the string as the
specified destination. Except it won't actually go there. It only reads up to
the first special character. Suppose I had these two batch files:
::TEST1.BAT
@echo off
call test2.bat
2:34:56.78p
::TEST2.BAT
@echo off
goto LBL%1
:LBL
echo I didn't go to a
label!
goto DONE
:LBL1
echo At label 1
goto DONE
:LBL2
echo At label 2
goto DONE
:DONE
When TEST1 runs, it
calls TEST2, passing it 2:34:56.78p as an argument. TEST2 then has a GOTO
command which you might think would get interpreted as GOTO LBL2:34:56.78p The
amazing thing is that it actually goes to LBL2! Everything from the colon on to
the right got ignored! So this is a way to make a jump in your program based on
a drive letter, hour, month or who knows what else.
Doctor
DOS Betamax's ...
DOS TIPS
Almost Sixty Helpful
Hints to
Allow You and Your
System to
Operate Quickly and
Efficiently
The following suggestions are chiefly aimed
at having DOS and your computer run faster, with less hassle & fewer
problems. However, some are more general and may be applied to non-DOS
computers, as well. These tips assume a basic knowledge of DOS and its path
& directory structure. Some assume usage of DR, MS or PC DOS 5, 6, 7, or
newer, but most will work fine for most DOS versions and manufacturers.
I use a disc cache with very aggressive
settings, plus a high-end memory manager for my lower, upper, high, expanded,
and extended memory areas. I also run a large RAM drive. All this is coupled
with a combination of batch files and keyboard macros to gain maximum speed of
operations with minimum keystrokes and tedium. These are briefly explained
below along with other helpful hints that will allow one to work towards
becoming a power user.
Note that deep detail will not usually be
gone into. If you want to know more about using certain options, see your DOS
or software manuals, view their on-screen help files, or see some of the many
Internet websites devoted to DOS tutorials and command references in the DOS
Websites section of this site.
With recent, fast computers some of these
suggestions may result in little difference unless the processor is overworked.
However, on slower systems, or when doing any long complicated chores, each
little tweak will add up to noticeable time saved. Even with faster processors,
using the following will keep things running efficiently, if for no other
reason than to reduce most tasks to just a few keystrokes, thus speeding you
up.
Most, if not all, of the DOS programs
mentioned here are available via The Internet. Again, see DOS Websites for
these and many, many others. A high number of DOS programs are share or free
ware, so the cost is minimal to try some wonderful software.
INFORMATION BELOW MAY
NOT BE REPRODUCED
WITHOUT PERMISSION
FROM THE AUTHOR ©
Let's Begin...
1/ Partition Hard Drives to Gain Maximum
Usage. For older DOS versions, hard
drive size is limited. Before version 3.3, size had to be 32 MBs or less. From
5.0, it was 2 GB. One way around that was to use after-market drive management
programs to allow for larger drives, but that resulted in compatibility issues.
A better method is to divide the drive into
smaller partitions. PC-DOS 3.3 allowed one to have multiple 32-MB partitions
and Microsoft's version 4 allowed the same. SInce version 5.0, one can have 2
GB ones, while other DOSes support FAT 32 to allow terrabyte sizes. However, to
remain compatible with a wider range of DOS programs over the years, FAT 16 is
recommended unless one needs to store multiple, large media files. Simply make
multiple 2 GB areas for different purposes. I have a main `C' drive for most
programs, a `D' drive for games and `E' is my media partition.
Partitioning has an advantage when keeping
all user data in a separate one. Doing so can guard that data in the event of
disc damage elsewhere, and can also give protection from those viruses which
don't jump partitions. Further to the latter, if one keeps no programs and only
data on one partition, the likelihood of data corruption can be reduced. In
addition, data on one partition allows easier backups.
2/ Use LABEL to Prevent Accidental Hard Drive
Formatting. Label each hard drive and
any partitions. If a format is accidentally issued for any fixed (hard) disc,
DOS will ask you to type the label name before a format begins.
For an extra measure of security, place an
ASCII (ASS-key) space in the label name. LABEL allows spaces anyway, but using
an ASCII space requires that one press & hold the ALT key while typing
"255" on the number pad, and then releasing the "ALT" key.
In order to reformat a hard drive or one of its partitions, the same sequence
must be issued when typing the label name. This technique will stop viruses
from formatting a drive unless a way around this has been programmed into the
virus.
3/ Keep the Path Short and APPENDed Directories
to a Minimum. When a command is issued,
DOS first looks at DOSKEY or Toddy Macros, 4DOS Aliases, or their equivalents
as available from other similar programs. Next it looks for an internal command
of the name typed at the command line. If it doesn't find a match, it searches
through the current directory. If a command (.com), executable (.exe), or batch
(.bat) match is not found there, and if there are no appended directories, DOS
refers to the path statement to see in what other directories it may look. In
each of those directories it again searches for a matching command, executable,
or batch file. The more directories in the path, the longer it takes DOS to
find the file required to execute your request.
As for appended directories, using APPEND
to allow programs to look for files in additional, designated directories can
add further to the problem if the appended directories are set during boot-up.
If this is the case, these directories will be searched any time DOS needs to
go beyond the current directory.
Be aware also, that major programs may have
up to several hundred files in their directories. If those big programs are in
the path, DOS may have to look through several large directories full of scores
of files to find what you requested. Having those large program directories in
the path can add a great amount of time to that search. If APPEND is required,
it is best to issue this command before a program needing it is run, then to
remove it when the program is closed. (See Below.)
You may shorten your path through the use
of batch files to start programs. A batch file directs DOS to the exact
directory and executable required to start a given program. This reduces the
search to just one directory and allows DOS to go immediately to work. I use
this technique so I have only two directories in my path: BATCH and DOS.
Once a batch file is set up to start a
program, then you should specify to that program where to look to find the
files required to run itself. This is done within the given program, or through
the DOS environment via the "SET" command, or by using the DOS
"APPEND" command. (See #34, farther on for "SET" tips.)
These programs' directories may then be removed from the path statement.
Another speed advantage to this is that the program itself no longer has to
look through the path to locate its own files because you have directly told it
where to locate them.
4/ Place Often-Used Directories near the Start
of the Path. Since most commands are
going to be DOS ones, place your DOS directory first in the path statement. DOS
will find its own commands faster this way since it does not have to search
through unnecessary directories. This does not apply to 4DOS Aliases, DOSKEY or
Toddy macros, or internal DOS commands; these are always in memory when DOS is
running. They are looked through first regardless of which directory is
current. However, the speed at which any non-internal commands used by these
macros or aliases are accessed is affected by their location in the path
(unless one issues complete paths with each command - see next).
5/ Issue Full Path & File Names for all
External Commands. Whenever you issue a
command, if a full path name is specified, DOS goes straight to the directory
containing the command and immediately issues that command. Thus, DOS does not
need to look through the path statement's directories at all. This skips a step
and possibly a lengthy search.
If the directory happens to contain the
command in .com, .exe and .bat forms, be sure to specify the appropriate
extension. This method also garners a bonus in the form of protection against
"companion" viruses. A companion virus will write a .com file to echo
an existing .exe file, but with the virus attached. Since a .com file has
priority, it will run first, thus spreading the virus. By using full path
names, including the file name extension, one may slow or prevent, to some
extent, the spread of this type of virus.
Since it's tedious to type full path names,
place your commonly used commands with their full paths in aliases, batch files
or macros. This way you will only need enter a few keystrokes to have DOS go
directly to work.
For really frequent usage, assign the batch
file or macro to a key. (See #47 farther on.)
6/ Keep Files Sorted by Using
Subdirectories. The novice user of most
any computer system typically fails to keep his or her hard drive sorted and
organized. This leads to confusion, slow operating, and sometimes conflicts
that make the computer behave in unexpected ways.
In a DOS system, if one allows the root
directory to hold a lot of files, the limit can quickly be reached. Most DOS
systems only allow 512 directories and files to occupy the root directory of a
given drive. Files should be grouped into subdirectories to avoid exceeding
that limit. The only files in the root should be the command interpreter
(typically COMMAND.com) and configuration files such as CONFIG.sys and
AUTOEXEC.bat. Note that it is possible to place some of these elsewhere, but
usually they are in the root. Some programs will place certain files in the
root directory and that is OK, but if you have a choice, put them into an
appropriate subdirectory.
By the same logic, make sub subdirectories
as necessary. Should one wish to move or delete a program and its files, if
they are grouped in with other things wished to be kept, a lot of time will be
wasted sorting out what is not to be deleted. Always create directories for
every subject and sub-subject.
For example, if you have a word processor,
all the files that processor uses should be in some sort of "WP"
directory. Then, if you create data files, make subdirectories for that data with
one directory for each category. So you might have one for each family member,
and each member might have his own categories under that such as
"CAR", "MUSIC", "WORK", and so on. This method is
the equivalent of having a file cabinet in which each subject is kept in a
separate file folder, or having a separate drawer for each type of tool in a
workshop.
You can even take this idea to DOS itself.
I have created eighteen subdirectories in my DOS directory. As an example, I
placed all DOS' device and system drivers in a subdirectory called
"DEVICES". When they are loaded via Config.sys or Autoexec.bat, I
show full path names so DOS can find them. Then during normal operation, DOS
does not have to look through those extra 20 or so files when perusing the DOS
directory.
Continuing with this technique, I managed
to cut down the files in the main DOS directory from over 150 to about 35 by
putting little or unused DOS files in other directories. This has lessened the
search time during the day to day running of DOS.
Many programs will allow you to do this,
but be sure they are capable of specifying to themselves where to find those
relocated files. As mentioned in #3, farther back, this requires the program
having either internal capability or being able to make use of DOS's
"SET" or "APPEND" commands. (See #34, farther on for
"SET" tips.)
7/ Keep File Names Short. Even if you use long file names in DOS, keep
the names no longer than necessary. Long names take up more room and take
longer to type, making for more work at the command line. They also mean fewer
file names can be displayed at the same time.
If using a directory utility and/or
auto-completion, longer file and directory names mean the number of choices
will increase. This makes for additional steps and extra time taken to peruse
the file list to locate the name you want.
With longer files names, users tend to be
less creative in coming up with different first-letter strings in order not to
have those first few letters duplicated in multiple file/directory names. The
likelihood of having duplicate character strings at the start of the name means
they will match too many other file names. That slows down directory and file
maintenance.
At the very least, if you use longer file
names try to make the first eight letters not match any other file names. To
aid in that endeavour, group like files in subdirectories so that subdirectory
name is no longer part of the file name. Thus, "IMG_001_2007-12-25.jpg"
could be in a directory under IMAGES called "XMAS2007", and the ones
shot on the 25th could be in a subdirectory called "12-25". This not
only makes it easier when searching for a particular file's name, it greatly
aids in hard drive organisation.
8/ Remove Unnecessary Backup and Temporary
Files. Computer operation is slowed
down when DOS has to look through unnecessary file names. In most cases,
programs delete .bak and .tmp files after using them, but some programs are
sloppy. As well, if an error occurred or the computer lost power/was shut off
before a program had finished & was exited, these files may remain to
clutter your hard drive.
To see which, if any, of these are on your
computer, issue DIR \*.tmp /P /S. This will list all such files on the current
drive, pausing after each screen fills, and include files in subdirectories. If
you are not currently running any programs, you may delete the .tmp files. Do
the same for *.bak files. You may delete these except for autoexec.bak and
config.bak files, or any others you know you've created for your own backup
purposes. If you are unsure of certain ones, move them to a flash drive,
external hard drive, or floppy disc for safe keeping. If problems arise, you
can always restore from the removable media. (Be sure to keep track of in which
directory each file was originally.) There are programs available that will
clean your drives of these files automatically, if you wish.
9/ Remove Duplicate Files. Files have a way of multiplying on your hard
drive. Not only are they usually a waste of space, but they increase the number
of files through which to look if they reside in directories included in a
given search. This can slow operations if there are a high number of these
files.
The solution is to identify & delete
these files wherever possible. I say "wherever possible" because some
duplicates may be used in different directories by different programs for
similar purposes. Eliminating one of those would likely cause a program error.
As well, it is wise to have some files duplicated in different directories as
back-ups. COMMAND.com is such an example.
To reduce the tedium of finding these
duplicates, use a program designed for the purpose. I use PC Tool's FileFind.
One of its abilities is to be able to locate duplicate files within, or across,
any number of drives. It allows one to include or exclude certain file types,
and searches can be narrowed or expanded as needed.
"FileFind" will display the file
names, sizes, and dates/times. You may then compare them and mark some or all
for deletion, or not. You may also view the files before making a decision.
After tagging the files, one "Delete" command eliminates all those
chosen.
10/ Consolidate or Archive Files to Save
Space. Files are saved on a hard drive
in memory allocation units. When a file occupies a given unit, no other file
can be kept there. If that file does not take up all the available room in that
unit, there is wasted space. This "slack space" can add up if many
small files are kept on a drive. However, one large file takes up less room
than several small ones. This is because the large file first fills as many
units as are required to preserve that file on the drive. Then leaves only the
last unit with slack space if the remaining part of the file fails to
completely fill that final allocation unit.
The space-saving solution is to combine
files together either by physically doing so or by keeping them in compressed
archives. The first method means locating like files such as READ-ME files and
using a word processor or text editor to place them in to one big file, then
deleting the small ones. An other method for text files of the same subject or
with the same program is to combine them using the DOS "COPY"
command. So all of a program's documentation files could be grouped into one
big file and then the individual files could be deleted.
COPY file1 + file2 +
file3... big-file.txt
or
COPY *.txt + *.doc
ALL-DOCS.txt
If however, you need to combine non-text
files, or must maintain the separateness of each file, a compressed archive is
the answer. For an example of one, see EDZIP.bat in Advanced Batch File
Examples II. Finally, to gain the maximum space, copy or zip files to another
hard drive, flash drive, floppy or zip discs, or burn them to CDs or DVDs. Be
aware that data on flash drives generally has a shorter shelf life than that on
well-stored discs.
Implementing Numbers
Three through Ten, above,
means that you and
the operating system and its
programs will do less
looking and more doing.
This speeds
operations.
11/ Use Wild Cards and Symbols to Lessen
Typing. DOS has some built-in shortcuts
that may be used instead of typing things out long hand. The Question Mark ( ?
) represents any single character in a filename. So if one wanted to rename the
"PROJECT" files in the current directory, instead of renaming each
file one at a time, one could use the Question Mark. Note that
"PROFILE.txt" will not be included in the renaming:
PROJECT1.txt
PROJECT2.txt
PROJECT3.txt
PROFILE.txt
REN PROJECT?.TXT
PROJECT?.DOC
The Asterisk ( * ) represents any number of
characters up to the limit of the file-name length usable in your version of
DOS. In the preceding example, using the Asterisk reduces typing even further:
REN PROJ*.TXT
PROJ*.DOC
To rename all .txt files in that directory:
REN *.TXT *.DOC
One may also use the Dot ( . ) to lessen
typing. A single Dot refers to the current directory, a Double Dot to the
parent directory. The first example below moves all backup files from the
BACKUP directory to the current one. The second moves all the backup files from
the current directory to the parent one:
MOVE C:\BACKUP\*.BAK
.
MOVE *.BAK ..\
See DOS Characters and Symbols for more.
12/ Cut Down the amount of Typing further by
Using Batch Files. Any time you type a
complicated command or a series of commands, you should consider making a batch
file if you intend to use this command or series again. This applies even if
you don't use it regularly. In both cases, a short batch file name is easier to
remember than a long character series. If any commands have a sequence of
switches (command modifiers) attached, they too, benefit from batch files. (See
#13, next, and also the DOS Switches discussion elsewhere at this website.
Part two of this is to use batch files for
all your routine work. I am forever copying & moving files to & from my
floppy and flash drives. So I wrote "CTB", MTB" and
"CFB", "MFB" batch files. They copy/move specified files
from the current directory to my `B' drive or vice versa. If no files are
specified, all files are copied or moved. Automatic directory listings after
the operation confirm the copy/move. See the Batch File Tutorial for some
basics on batch file creating, and Batch File Examples for the batch files just
mentioned.
13/ Use Switches to Tailor Commands. Most DOS commands have a series of switches
that are able to modify the command to make it do more work. They take the form
of the command followed by a forward slash and then a letter, word, or word
abbreviation. The most common one is the "DIR" command which can sort
files by size, name, extension, date, etc., among other options by using switches.
In most DOS versions made since 1990, to see what switches are available and
their syntax as related to a given command, simply type a command name,
followed by a space, a forward slash, and a question mark. For example:
DIR /?
One may take this farther by writing a
number of slightly varied batch files containing the same command, but each
with selected switches. This serves to vary that command and reduce the number
of keystrokes at the same time. Thus one "DIR" batch file might give
a wide display with lots of file information, while another might display
directories only, and a third might show files only in alphabetical order.
These versions might be named "DIRW", "DIRD",
"DIRA". To make this idea yet even more powerful, assign these batch files
to function keys. (See #47 farther on.) See also the DOS Switches discussion
elsewhere at this website.
14/ Use Batch Files to Move to Frequently-Used
Directories. In keeping with Tip
Numbers 5, 6 & 10, instead of typing long directory paths for commands or
to reach the subdirectories you have created, have batch files to do it for
you. I have ones that display the files from the DOS directory, take me to my
Download & Upload directories, to my Utility and Batch File directories,
and so on. In fact, in several cases, I have it set up so that I may choose to
simply display the directory without moving, or to actually go to the given
directory and display its contents.
I also have simple, 3-letter batch files
that display only a directory's .bat, .com, .doc, .exe, .htm, .txt, .zip, or
graphics (.gif, .jpg, .pcx, etc.) files, and also one to display my keyboard
macros. These keyboard macros are set up to move me to my most-used directories
and display the contents in one keystroke, rather than typing in a batch file
name and pressing "ENTER". (See #47 farther on, for tips regarding
DOS keyboard macros.)
If you have a great many directories,
having a batch file shortcut to each one means a lot of small files. As
discussed earlier, these take up a lot of room. A good number of them would be
little used and when needed, the user may not be able to remember the batch
file name. In this case, it is more logical to use a directory utility. This
allows one to type a partial directory name and the program will take one
there, or it will present a list of possible choices. This saves typing a drive
letter and the complete path; plus it removes the clutter of a lot of small
batch files. I use Directory Maven, but there are many others from which to choose.
15/ Have Batch Files Start all Major
Programs. In keeping with the last
three tips, make up batch files for all major programs you use. Not only does
this save moving to a program's directory in order to start it, but one can
incorporate into the batch file the necessary switches and variables one might
typically employ when using that program. You might even write several
scenarios for that program and set it up so that a single letter following the
batch file name executes the desired scenario.
As discussed later in Tip #34, one could
incorporate the environmental necessities required by a program into its batch
file to save typing them or to save having them in a DOS startup file. Further,
if one needs to temporarily add a program to the path, set ASSIGN, JOIN,
SETVER, SHARE, SUBST, or other requirements in order to run a program
(especially very old ones), do these only within the batch file that starts
each given application. Then place commands to disable or remove them after the
close of the program. Using this technique means they won't be taking up memory
during other operations nor will they slow things down unnecessarily when the
given program is not running.
16/ Employ an Auto-Completion Utility. With this, one types a partial program name,
or a command followed by a partial directory or file name, and then strikes a
designated key. Upon pressing that key, the directory, file, or program name
that matches the first few letters will be completed automatically. If there
are more than one match, either a list will be presented, or the matches will
be shown in sequence until the desired one appears. This allows one to diminish
typing down to only a few characters.
The best ones can even work remotely in
other directories. So if one has a directory "C:\UPLOAD\HOLD" with a
file called "READ-ME.TXT" in it, a good auto-completion program will
complete each portion for you:
DIR C:\U will be
completed to DIR C:\UPLOAD
Adding \H will
complete to DIR C:\UPLOAD\HOLD
Adding \R will
complete to DIR C:\UPLOAD\HOLD\READ-ME.TXT
I use Toddy, but any similar utility will
work.
17/ Repeat Commands Quickly with a
Command-History Utility. Again, I use
Toddy, but there are others. DOSKEY is one that is included with several
versions of DOS. This type of utility allows one to call up any command line
entry used during a session and then to re-execute it, or to edit and
re-execute. This saves typing the same commands over & over. (Note that a
user-setable limit is typically allowed so as to prevent days or even weeks
worth of commands from being kept, should you not turn your computer off or
reboot on a regular basis.)
18/ Maximise Memory Usage with a Memory Manager. Having the maximum Lower (Conventional)
Memory available, makes DOS a very happy operating system. If you have a 386
processor, or higher, then you may make use of Upper Memory to load much of DOS
and any TSR (Terminate and Stay Resident) programs. Managers also provide
access to, and control of, Expanded and Extended Memory. Plus, many offer
Protected Mode services so users can run the latest DOS 32-bit protected mode
applications.
I use Quarterdeck's QEMM 9.0 for maximum
memory management. DR-DOS comes with MEMMAX, MS-DOS with MemMaker. These, as do
other memory managers, will juggle and then load as many programs outside of
Lower Memory as possible. You must load DOS' HIMEM.sys and EMM386.exe, plus use
DOS=HIGH,UMB (or equivalents) in CONFIG.sys to accomplish this. (Realise that
"DR-DOS" is pronounced "Dee-Arr DOS".)
Note that even pre-386 computers may also
take advantage of some of this capability through after-market software.
19/ Load Large Programs First. If you use DOS's "MEMMAKER", after
running it, check your DOS directory for a file called MEMMAKER.STS. In it,
you'll see the programs loaded. Note the loading (MaxSize) size for each. Then
edit your config.sys and autoexec.bat so that the largest of these are placed
first, with the remainder in descending-size order.
The reason for this is that some of these
programs take a lot of memory to load but have a small final (running) size. If
upper memory is mostly used up by other programs that were loaded first, trying
to load a program whose loading size exceeds available remaining memory, will
automatically cause it to be loaded low. This is even if there's enough room in
upper memory for its final running size.
Having these programs load early while
there is still enough headroom available, means they will get loaded and leave
room for some smaller programs. This trick will often result in being able to
load one, two, or even three more programs high, thus conserving all important
low memory. A similar technique may be used with other memory managers that
don't juggle the order automatically.
Even without a manager program, one may
still take advantage of this method through trial & error juggling of the
load order. You may find that a program that couldn't be loaded high, now can.
Or, it may be that an exchange of a larger program for a smaller one in upper
memory, will increase the amount of lower memory available. Experiment.
20/ Use a Disc Cache to Speed Access. Whenever DOS works, it often must go to the
hard drive for information. This takes time, especially if the heads have moved
away from the area needing to be read. The less DOS reads the drive, the faster
are operations. A cache stores the latest-accessed files in memory; this allows
memory-speed access instead of slower disc reading.
In addition, if you enable
"Write" caching, files being written will only go to the disc when
the system is idle. This allows the command prompt to return or programs to
continue, so you may work while disc writing goes on in the background. A
disadvantage to this is that data might be lost if there is a power failure or
lock-up before the writing has completed. I have never experienced this but
those of you in areas where power is less reliable may not want to enable Write
Caching. The same suggestion is directed at those experiencing frequent
lock-ups because of conflicts or aggressive experimentation.
Most major DOS versions come with a disc
cache. DR-DOS uses PC-KWIK or NWCACHE while MS-DOS has one called Smart Drive
(SMARTDRV.exe, or SMARTDRV.sys in older versions). There are third-party ones
too; Norton's NUCACHE and PC Tools' PC-CACHE come to mind. I use SpeedWare's
excellent HyperDisk.
Be sure to lower your BUFFERS setting if
using a disc cache. DOS looks at its own buffers before the cache. If there are
too many, the delay will be longer before DOS begins to peruse the disc cache.
Lower BUFFERS to 10 or less, and remove the Look-Ahead setting completely if
that feature is included in your DOS version of BUFFERS. This is the second
number in the BUFFERS setting; the one after the comma. It is also known as the
"Read-Ahead" buffer or "Secondary Cache". Lowering the BUFFERS
number also has the advantage of freeing up more memory, as each takes up 512 -
528k of memory. I have a BUFFERS setting of `4' and have experienced no
problems even with older DOS software.
21/ Keep Hard Drives Defragmented for Faster
Access. When a file is erased, the
space becomes available for DOS to place a new file there. If the new file is
too large, it still fills the available space, but the remaining portion of
this new file is placed elsewhere on the disc. For very large files, there may
be fragments all over the drive. Multiply that by a large number of files, and
retrieval speed decreases. Plus, if you are not using a deleted-file directory,
the likelihood of DOS's UNDELETE program being able to recover an accidentally
deleted file decreases if the file was fragmented. Run a defrag program once a
week, or more often if you write and erase a lot of files in a shorter period.
DOS supplies DEFRAG but there are others available. I use Norton's Speed Disk.
Have your defrag program place the largest
files first on the hard drive. Large files tend to often be program
executables, which don't change unless attacked by a virus.
If available, you may request that the
defrag program place .exe and .com files first; these are your main program
files. These never change size (unless you are experimenting with programming
or have a virus), and never increase/decrease in number (unless you add/remove
software). So for the most part, they never move.
The defrag program will gloss right over
these unchanging files and only deal with the fluctuating file space on the
drive. This lessens the time the program takes to complete its operation.
22/ Speed up the Boot Process. To gain a faster boot, implement some or all
of the suggestions below if they are available from your computer or DOS
version. Be aware that doing some of these may cause problems under certain
circumstances.
CMOS and DOS START
Disable Seeks of
Floppy Drives and Nonexisting Hard Drives
Disable Checking of
Memory Modules
Boot from the Fastest
Drive (Boot Order)
Disable the F5/F8
Pause
DOS STARTUP FILES
Disable Memory
Manager Checks of Memory Modules
Remove Unnecessary
Programs and Start them only as Needed
Remove Unnecessary
Tasks and Checks. Implement them only with their Associated Programs
Organise CONFIG.sys
and AUTOEXEC.bat in the most Efficient Order
23/ Check and Exercise your Boot Media. When was the last time you tried your boot
disc? Do you even know where it is? Are you sure it will still boot your
computer? Have you added utilities to your system that are now needed during
boot-up? Every month or so, it is wise to try to boot your system using your
boot disc. This is to ensure it still works and that it will configure your
system as it is currently. Don't wait for a crash or other problem to find out
the disc has corrupted information, has bad sectors, or is outdated.
Use SCANDISK or other utility to check for
physical damage and corrupted information. Check to be sure all needed drivers,
utilities, and files are included. A common forgettable is to have no, or
improper, CD-ROM/DVD drivers. For a floppy, add the required new files so that
the boot disc will be compatible with your present setup, and then defragment.
Lock out the disc to guard against it being written to by you or a virus, and
afterwards try it to see if it boots your computer. For CDs, burn a new disc
and then verify the integrity of the information by doing a test boot. Flash
drives cannot be locked out, so they should be checked for boot and other
viruses. In all cases, files should be made to be read-only. A working boot
medium is a recovery tool one cannot be without.
24/ Use VERIFY to Check Copied or Moved Files. Many DOS versions have a `/V' switch that
will read the file after it is copied or moved to its destination. For such
actions within the same hard drive, this is generally unnecessary unless one
suspects a failing hard drive. (In that case, replace the drive as soon as
possible!)
However, for removable media where the
information is not being kept elsewhere, if the files are vital, it is best to
be sure they can be read after the operation has been done. Using the `/V'
switch causes DOS to see if the file can be read from the destination drive and
if it can, it is likely the transfer was successful. I say "likely"
because the integrity of the data is not looked at. DOS simply sees if it can
read the file without error. This does not guarantee that the file was not
corrupted during copy or transfer, but does add a measure of safety for
important data transfers.
25/ Use a Task-Swapper. Such software loads all requested programs
into memory so they are only a keystroke away. This beats shelling out of a
program to access another, or even quitting the program because you cannot
access another due to memory constraints. Plus, you are returned to exactly
where you left off when switching back to a previous program. This generally
requires memory above 1 megabyte and if you want to load a lot of programs, you
will have to increase memory further still. I use DR-DOS' Task Manager or Back
& Forth by Progressive Solutions. (Note that "DR-DOS" is
pronounced "Dee-Arr DOS".)
SAVE! SAVE! SAVE!
Before swapping to another task always save
your work. If anything goes wrong or you lose power, your work will have been
written to disc. This is very important if you are running several tasks at
once, each of which has work or changes that will need to be kept.
This is a good rule even when not task
swapping. Save often while working, not just after completion. I set
"ALT-S" to save work in any program that allows such a setting to be
made. Then while working, I often hit "ALT-S". It's very, very rare
that I ever lose work, and then it's only a few sentences, or one change in a
graphics program.
26/ Set Up a RAM Drive. A RAM Drive (or virtual disc) is an area of
memory that DOS treats as a regular disc drive. At startup, the most used files
and software should be loaded on to the RAM Drive which means they are always
in memory. Then point programs to the RAM Drive instead of your hard drive.
Employing a RAM drive is far faster than accessing a hard drive for files.
On my main system, I have an excessive
amount of memory available for a DOS machine (328 MB). It's divided as 1 MB of
Lower and Upper memory, a 64 MB RAM Drive and the balance as straight Extended
Memory, with Expanded Memory emulated from the latter as necessary. I have all
the regularly-used DOS operating system files (including the COMMAND.com and
4DOS.com shells), plus all DOS batch files & keyboard macros on the RAM
drive. I also have items such as a file viewer, two text editors and
WordPerfect's Spell Checker files always there - plus all their support files.
In addition, all programs creating swap or temporary files are directed to
place those files on to the RAM drive.
Such a method greatly speeds operations.
This type of performance enhancement is especially noticeable with slower
processors and hard drives, but is blindingly fast on newer equipment. DOS
typically comes with RAMDRIVE.sys or VDISK.sys, but I use Franck Uberto's
XMSDisk. It allows a greater number of options and a greater range within each
option.
If you decide to use a RAM drive, you must
change your path statement to point to the RAM-Drive directories first.
Otherwise, instead of proceeding directly to the RAM drive directories, DOS
will do a hard disc hunt. Being an unnecessary search, it slows operations. On
none of my setups, do I have hard drive directories in the PATH statement. It
only references RAM drive directories. All operations are handled through each
system's RAM drive.
Be sure to copy to the hard drive any RAM
Drive files you have modified and wish to save before turning off or rebooting
your computer. They will be lost if you do not. (I eliminate this step by
always having programs write directly to a hard drive.) Note that program files
need not be copied before shutting down because they are already on your hard
drive and were simply copied to the RAM drive upon startup, as they will be at
the next startup.
I have a batch file, LOAD-RAM.bat, that is
called by AUTOEXEC.bat. It handles the task of placing the appropriate files on
to the RAM drive upon bootup. The advantage of this is that during testing I
can disable the calling of LOAD-RAM.bat and speed diagnostic operations.
Otherwise, I would have to disable each RAM-drive load request individually if
each was in AUTOEXEC.bat.
Point your "temp" and
"tmp" variables to the RAM Drive. DOS and its programs make &
erase files as they operate and they use a "temp" directory to do so,
unless one has not been set up. In that case, the program's executable
directory is typically used, slowing things more due to the number of files
through which the program must look.
Either way, it takes longer to write these
files to the hard drive than to memory, so set your "Temp" variables
to point to the RAM Drive. In the AUTOEXEC.bat:
MD F:\TEMP
SET TEMP=F:\TEMP
SET TMP=F:\TEMP
Be sure to substitute your RAM drive letter
for `F', should it be different. Run your AUTOEXEC.bat file, or reboot to have
the changes take affect.
A nice advantage of this is that when the
computer is turned off or rebooted, any temporary files remaining are deleted
automatically. This is because the RAM drive only exists in memory until power
is removed or it is re-initialised by a reboot.
27/ Place Batch Files in Memory. Have your AUTOEXEC.bat create a batch
directory on your RAM drive and then copy your batch files to it. Place the RAM
drive batch directory at the start of your path statement. These will execute
much faster than if they had to be read from the hard drive every time.
4DOS users have part of this capability
built in if they use .btm files. 4DOS reads the .btm batch file from the disc
only once and then keeps it in memory until completed.
28/ Use "ATTRIB" to Protect Files. For files that you do not want to be modified
or erased, change their attributes to "Read-Only" via the ATTRIB
command. This is especially good for forms such as a letter or fax template in
your word processor, a base template in a spreadsheet program, an html webpage
template, or for a DOS batch-file starter file, since these often start and end
the same way. Simply change to the directory within the program that holds the
file(s) you wish to be protected, and enter:
Attrib +r
filename.ext
You may use wild cards ( * ? ) to make
blocks of files read-only. This could be employed to make all .com, .exe, and
.bat files read-only. Doing so protects against viruses that overwrite such
files with their own versions, However, this only works with viruses not smart
enough to remove the read-only attribute. Regardless, it's a preventive measure
to do this in your DOS directory to prevent accidental erasure. (See Tip #11
for wild card discussion.)
Be sure to use ATTRIB to make your
configuration files Read-Only. Programs that modify the AUTOEXEC.bat and
CONFIG.sys files will not usually try to remove that attribute in order to make
changes. This trick provides a measure of protection, allowing one to decide if
and when such changes can be made.
As well, this method provides some
protection against attempts by users, other than yourself, to modify your
configuration files. Only knowledgeable users will figure out that the
Read-Only attribute is blocking them.
29/ Press "CONTROL-C" to Stop any DOS
Action. If you have issued a command and
things are not going as you intended, press "CONTROL-C" or
"CONTROL-BREAK" to stop the work. DOS checks to see if either key
combination has been pressed and it will cease operations immediately after
reading that key combination. This also usually works within a program.
To be assured that mis-commands are stopped
quickly, have "BREAK" set to "On". DOS checks more
frequently when BREAK is on. You may set it to "On" from the command
line by entering" "BREAK=ON". Entering "BREAK" by
itself, tells you its status. To automate this, place "BREAK=ON" at
or near the end of your AUTOEXEC.bat.
Be aware that some programs will set BREAK
to "off". You may test this by first making sure BREAK is on, then
running the program, exiting, and checking the BREAK status again. If it resets
BREAK, then place a "BREAK=ON" command at the end of the batch file
you should be using to start that program. As you find other programs that
reset BREAK, then place the same command at the end of each of their batch
files.
30/ Back Up Your Configuration Files. When using a program, one typically alters
the look, operation, or setup to suit one's tastes. Those changes are held in
some sort of configuration file. If they should become lost, corrupted, or
otherwise changed in ways that you do not desire, you would have to reset all
the changed parameters.
However, if you have copies of these files,
all that is required to restore, or return to, your previous settings, is to
copy the appropriate file from the backup to the program directory. Typical DOS
configuration files have extensions like: .cfg, .set, .ini, .pif, etc. These
examples stand for "Configuration", "Settings" (or
"Setup"), "Initialization", and "Program Information
File". There are others - see DOS File Extensions, elsewhere at this
website.
An easy way to make copies is to add these
files to your regular backup routine by including them in the batch files you
should be using to do the backups. You may also decide to write an exclusive
"Configuration Backup" batch file that would go to each program
directory in turn and copy the appropriate files all to one disc. Then it's an
easy matter to return to, or restore, any program's settings. You may wish to
arrange for all configuration files to be placed into one .zip file with the
file name being the date the file was created. If a series of these files are
archived, one may then return to any configuration date wished. A batch file
can do this automatically including placing the date as the file name. See Batch
File Basics for a tutorial on writing simple batch files.
Don't forget your CMOS configuration
either. Copy each setting, or if your computer allows, turn on your printer and
hit "Print Screen" for each configuration screen. Now, if your
battery dies, you'll be able to restore the basic setup of your computer in
just a few minutes. The "Print Screen" key is handy for any times
when you are changing configuration settings. Having a print out from before
any changes are made makes it simple to restore settings if need be, but a hard
copy can also be used as a check list.
31/ Use a Phrase to Remember ANSI Colours. If you use ANSI.sys or an equivalent for
screen colour control, you may have trouble remembering the colour codes.
Here's a chart for those colours and their foreground & background number
codes. Afterwards, will be a method you may use to remember the colour
order. FOREGROUND BACKGROUND
COLOUR COLOUR
CODE CODE
30
Black 40
31
Red 41
32
Green 42
33
Yellow 43
34
Blue 44
35
Magenta 45
36
Cyan 46
37
White 47
To remember this,
simply use the
following phrase:
Boys Ride
Green Yaks, But
Mary Can Wait
32/ Cut Off Your Mouse's Tail. This may seem a little drastic, but at the
least, learn to use a program's keyboard shortcuts and macros. For any program
in which you are using the keyboard for data entry, such as a spreadsheet,
database, or word processor, it's much faster to not have to remove your hands
from the keys to go to the mouse, move up to a menu bar, click on a menu, run
down that menu, click on another item, run down that, and so on. If one key
stroke can do all that in place of the desk rodent, then learn that keystroke.
Even with a tool bar, this method is still faster because your hands never
leave the keyboard. You'll be surprised how much faster you'll finish your work
by learning and becoming comfortable with key shortcuts.
To
facilitate efficient usage, adopt the "claw" hand method. Many, when
first learning keyboard shortcuts, will often use two hands to issue
"Control", "Alt" and "Shift" keyboard
combinations. Instead, learn to use one hand to span the keys. Typically, place
the thumb or little finger on the "Control", "Alt" or
"Shift" key, span the hand and place the most convenient finger on to
the other key. You will eventually find the most comfortable claw position of
the hand and it will come as naturally to you as a guitarist's finger patterns
do for producing chords on a guitar. Your speed will amaze even yourself as you
"span" your way around a program's abilities.
By a similar token, learn to use the
program's script or macro language. (Many are just like DOS batch files.)
Program in your most frequent operations and assign each to a convenient key or
key combination. From then on, one keystroke will eliminate almost all
desk-rodent tedium.
All this will be very difficult if you were
taught computer using a mouse. You will have to force yourself to adopt these
new techniques. However, if you can discipline yourself do this, once you
become comfortable with the equivalent keystrokes, you will never go back to
the slow, tedious, desk rodent method.
33/ Place Your Mouse to the Left. If you must use the desk rodent, place it to
the left of the keyboard. The advantage to this is that one may use the right
hand to access the Number Pad, Page Up/Down, Home/End, and Cursor keys, plus
their Control, Alt, & Shift variations - all simultaneously with the mouse.
This is excellent for eliminating arm movements because instead of using the
cumbersome scroll-bars, the cursor or Page-Up/Page-Down keys may be used.
Fatigue will be cut back, and the possibility of developing carpal-tunnel
syndrome is lessened. In addition, for many programs, the keyboard is much
faster than the hoops through which one must jump with a mouse to navigate
typical program menus.
After switching the mouse location, leave
the buttons as are so that "left-clicking" still uses the left
button. This allows one to easily follow instructions in a tutorial or book
because one need not mentally exchange the button designations.
Think about dumping your mouse altogether
and going with a full-size, weighted, desktop trackball. Now, you may be
thinking: "Oh, those horrible little balls...". No, I don't mean one
of those laptop finger-balls, nor do I mean one of those mouse thumb-balls.
They are horrible. I am referring to a stand-alone, large, desktop unit
containing a trackball the size of at least a billiard ball. In some models,
the size approaches that of a softball.
The advantages of it are that it is always
in the same spot on your desk, you can never run out of `mouse' pad, and
arm/wrist movements are greatly diminished. If a weighted one is used, one may
also spin & release it to quickly park the on-screen pointer in one corner
or another of the screen.
I also find a trackball better during
sensitive work, such as pixel-level graphic manipulations. After positioning
the pointer, I can easily lift my hand or fingers off the ball and then click
without disturbing the pointer location. The trackball housing is rooted to the
desk and is much more solid & stable than the movable mouse. I use the
excellent Kensington "Expert Mouse", Model #64215 both at work and at
home.
Here's an Extra-Extra
Tip:
When the trackball begins to skip, becomes
sluggish, or is slippery to grip, remove the ball and clean it with methanol or
rubbing alcohol. Then take fine-grit sandpaper and cup it in the palm of your
hand. Turn the ball within the sandpaper while applying pressure so that the
ball's surface becomes dull. Lightly sand the entire surface of the ball. Clean
once more with alcohol and replace. You will find the trackball will work as
new. Do this whenever the ball becomes shiny from usage.
34/ Reduce Environment Memory Load. Many programs require or, at least, often
prefer that a DOS environment variable be set. This is to direct the program to
required files, to direct it as to where to place & find temporary files,
or to set other parameters. Most have the user place the command in the
AUTOEXEC.bat. However, this means that this information is always in memory and
taking up space even when their companion programs are not even loaded.
The solution is to place the
"SET" command for each program within the batch file you should be using
to start that program. Place it on the line just before that which starts the
program. After the program-starting line, place another that reads SET
parameter= . Note that nothing is to follow the "equals" sign. This
removes the variable from memory as soon as the program ends by effectively
setting it to `zero'.
The advantages to this are less memory used
when the program is not running, a faster bootup (since the variables are not
set at that time), and it keeps all program starting commands, switches &
variables in one file. The latter is handy for personal reference and for
computer housekeeping purposes.
To see how much memory is taken by your
current environment, issue: SET > SIZE.ENV. This saves it to a file. Now
enter: DIR SIZE.ENV. and look at the file size. It will be slightly larger by a
few tens of bytes than the memory used because the file itself requires some
disc space. However, this will give you an idea of what is being used. You may
cut back on the room allocated for the environment through the
"SHELL" command in the CONFIG.sys file if too much has been assigned.
See your DOS manual for instructions. Don't make it too small though; you'll
need space for any temporary variables created by your and/or your batch files.
For those environment variables that you
issue in your AUTOEXEC.bat, be sure to place "SET" commands after
those loading drivers or other programs whenever possible.
If they are located before the lines used
to load drivers or other programs, DOS passes the information to each of those
that follow, whether those programs use the information or not. This takes time
and uses memory unnecessarily.
35/ Increase Your Keyboard Buffer Size. If you find during fast typing that
keystrokes are no longer being accepted and the computer beeps, or if you hold
down a cursor key and a few seconds later a series of beeps emanates, the
keyboard buffer has filled. You must then wait for DOS to process the
keystrokes to be able to continue.
When a key is pressed, the key code goes to
a holding area called the "keyboard buffer". There is only so much
room, so if one types quickly or is using a slow program, it will fill.
Eliminate this and the associated wait by increasing the buffer size. MS-DOS
7\DOS 95 and later allow this as do modern DOS versions, but there are many
after-market programs available for those using earlier versions. I use
ANSIPLUS by Kristopher Sweger. My buffer has been increased from the DOS
default of 15 characters to 128. I have yet to overflow it.
The advantage of this is more than just
being able to type farther ahead on say, a word processor. It also allows you
to program ahead. That is, you may issue a series of commands that might
ordinarily overflow the buffer, but that will continue to be accepted and
issued in turn as the program becomes ready to accept them. Thus you may type
those commands and then leave the keyboard to do other things while the program
runs unattended. With a menu system, this is not possible because one must wait
for the next menu in order to click on the next command. On the other hand,
well-written menu systems have first-letter commands that can sometimes be
implemented without the menu having to be on screen. For systems with that
ability, one may use this trick with them.
36/ Use a Key Stacker. For programs that do not accept command-line
start parameters, one ordinarily would start the program and then have to issue
a series of commands to get to the start-up screen of choice or to load a file
on which to work. With a Key Stacker, one may start the program and issue those
keystrokes directly from the command line all at once.
The key Stacker program takes the
commands from the keyboard buffer and enters them just as though you had typed them
yourself after the program had started. Place these into a batch file and one
may start any program and reach any screen or do any work by just issuing the
one batch command. Again, I use ANSIPLUS.
38/ Set LASTDRIVE to the actual Last Drive Letter
in your System. Your CONFIG.sys assigns
the last drive letter used by your system. Some setups have it fixed much
higher to allow for user mounting of external components such as USB
flashdrives. These are assigned a drive letter as required. Each drive letter
uses memory, so an excessive number wastes it. The amount is small, typically
176 bytes, but on memory-strapped systems, it may be a factor.
Inventory the fixed drives on your system
and then add letters to account for an external hard drive, camera, flashdrive
and so on. Add only enough letters to cover such devices plugged in at the same
time. If you only mount one of them at a time, add just one letter. Edit
CONFIG.sys to reflect this actual last drive letter and you will save memory.
38/ Make Use of Command-Line Utilities. Many programs are accompanied by utilities
that may be used outside the program itself. As well, there are zillions of
stand-alone utilities available that can accomplish small and large tasks.
These might perform file conversions, screen captures, font changes, text
search & replace, function-key programming or even complete keyboard
re-mapping, among many other chores or assignments.
Don't be afraid to use old ones, either.
They can still perform useful functions, even in today's computer world. I
still use various utilities from 1988! They do exactly what I want and I can't
think of an improvement that a modern version might incorporate. Most will run
fine on fast computers and under the most recent DOS versions. Some of them may
not present themselves well on the screen because they might use only
four-colour graphics, but so what? If they perform a useful function, they come
& go so quickly, that this is of little consequence except to the most
eye-candy conscious. For those persons, it may be possible to hide the output
and substitute one's own, or to dispense with it all together if a visible
result is not necessary or desired. (See the Extra Tip, below.)
The best utilities to use are those that
are small (under 50k), are not memory resident, and that serve just one
function. This means that they do not take up precious Lower or Upper Memory,
and that they execute very quickly. The former is less of a problem in the 21st
century because so many of today's utilities use Expanded or Extended Memory.
The latter is good because when a utility executes quickly, there are no delays
when using it, except on the slowest of processors. That means one may string
several of them together in a batch file to accomplish very specific tasks -
all with one command or keystroke, and without having to actually start some
program and deal with its interface.
Set utilities up to run from batch files
via their command-line switches so that the program interface need not be seen.
Make them able to work automatically on all the files in a directory, or on
specific types of files, or on only those you specify along with the utility
name. With a single command, the work will be done! For really fast work,
assign your most commonly used utilities to function keys. (See #47.)
For more on command or program modifying,
see DOS Switches, and view the Batch File Tutorial to see how to make these
utilities work for you with a minimum of hassle by placing the commands into
simple batch files.
To learn to hide output, read up on the
following possible methods:
Redirect output to
nothing via `> Nul'.
Redirect output to a
file via `> filename.ext'.
See if the utility
you use has a quiet or non-verbose mode via `/q' or `/v-'.
Use `CTTY NUL' before
the command which output you want silenced and `CTTY CON' afterwards. (Note
that these two commands must be used in a batch file because typing `CTTY NUL'
would transfer control away from your keyboard and monitor so no input from the
user would be available to type `CTTY CON' afterwards.)
39/ Use DOS to Run Your GUI. Most modern operating systems come with DOS
or a DOS emulator. Learn to use it to automate the tedium out of point &
click menu surfing and tree climbing. Using batch files and just direct issuing
of commands are often shorter and easier than navigating endless menus and
pointing at each individual step to complete a task.
40/ Use the Latest DOS Version. Many people believe the latest DOS version
is MS-DOS 6.22. Well, it is over a decade and a half old! Many new versions
have been developed by other companies since then, and because they are newer,
they have capabilities that the old Microsoft one doesn't. These versions are
much more powerful and add a lot of new abilities to DOS. Include are updated
DOS commands, memory management, FAT 32 capability, and so on.
This tip couples with the next one:
41/ Obtain the Latest DOS Command and Utility Updates
or Replacements. As you read in the
last tip, just because Microsoft has ceased developing DOS, does not mean
others have. Even if you wish to use an older DOS version, you may add
capabilities to it by after-market products. Some updated or replaced commands
and utilities that come to mind are ANSIPLUS, ColorDIR, EKKO, TODDY, XSET and
XXCOPY. DR-DOS has XDIR and XDEL. The `X' in these commands usually stands for
"extended".
Another is 4DOS. It is an updated command
shell that completely replaces COMMAND.com (the DOS command interpreter). It
comes with improved internal commands for both batch files and the command
line, and it has many, many built-in environmental variables. 4DOS is extremely
powerful and is highly recommended. Its latest updates were added just this
year (2009).
42/ Place Important Files First or Last via the
Use of Special Characters. Even with an
alphabetical list, in a larger directory, it may take a bit to locate a desired
file. It would be great if this file could always be first or last in a directory
listing. The solution is to use one of the special keyboard symbols as the
first character in the file name.
This first list gives the symbols that
show at the top of an alphabetical DOS "DIR" listing when used as the
first character of a file name. They are in order from top of the directory
listing on down.
Exclamation Mark [ !
]
Octothorpe [ # ]
Dollar Sign [ $ ]
Percent Sign [ % ]
Ampersand [ & ]
Right Single Quote or
Apostrophe [ ' ]
Opening Parenthesis [
( ]
Closing Parenthesis [
) ]
Dash [ - ]
Have one of these as the first character
in a file name and it will be shown before those starting with numbers or
letters. If you have other important files in a given directory then use other
characters from the list. The above is the order in which these files will appear.
Realise that not all directory programs may adhere to this order.
After the above, files beginning with a
number appear in order of Zero [ 0 ] through Nine [ 9 ]. Then one more symbol
character will appear before the files starting with a letter. It is the
"At" [ @ ] sign. However, the "dot" and "dot-dot"
representing the current and parent directories come first as thus:
Current Directory [ .
]
Parent Directory [ ..
]
Numbers [ 0 1 2 3 4 5
6 7 8 9 ]
At Sign [ @ ]
Now, to finish up, here are
first-character symbols that cause a file to appear at the bottom of a file
listing: These are in order from middle of the listing on down to last place.
Circumflex [ ^ ]
Underscore [ _ ]
Left Single Quote [ `
]
Left Brace [ { ]
Right Brace [ } ]
Tilde [ ~ ]
Be aware that it's possible that under
rare circumstances, having a file start with certain ones of the characters
shown in the above lists might interfere with a DOS operation. The most likely
ones to cause problems are the dollar sign, percent sign, at sign, and the
tilde. These are used by DOS for certain purposes, but given that these are
legal DOS characters for file names means that DOS should recognise that a file
exists with such a character and act accordingly.
I have not had a problem, so I don't
recommend not using these, but if odd things happen with directories containing
files which first character is one of the above, test to see if it is
interfering.
Realise that there are many other ASCII symbols
that may be used. They may be created at the DOS prompt by holding the ALT key
and typing a number on the number key pad. After releasing the ALT key, the
symbol appears. A list of these may be found in many DOS books. Experiment with
them to see where they fall in a directory list.
Finally, you may also apply this
technique to directory names if you want to have them in a specific order.
43/ Install a Scroll-Back Utility. Missed that error message? Need to see that
directory listing from several screens ago? Use a scroll-back utility. It
allows the user, via a hot key, to look back through previous screens to view
the output there. Some will even show the last screen of some text-based
applications. It will often even allow one to scroll "outside" of the
current application to see those bygone screens. I use ANSIPLUS.
44/ Keep Software and Utility Discs in their
Original Packages. This has a number of
advantages. The first is that the discs are likely to be better protected in
the manufacturer's packaging as opposed to being out in the open, or in some
rack or storage carousel or flip-top box.
That aside, locating a disc when needed is
generally far easier if it's in the box with all its documentation, or in the
pouch provided with its book. A plus to this is that you have the disc and its
information in one location. You'll find this a bonus when years after buying a
particular software or reference book, you'll find it's needed but have
forgotten some aspect of its operation. Having the documentation right there
relieves one of the frustration of searching for it in another location.
Keeping all items together also saves having two separate storage systems.
Reserve just one shelf or book case with everything organised collectively.
Finally, if you decide to sell or give away
the software, the recipient will be much happier if he gets the entire package
that came with it. This is never more so true when it is a book with an
attached disc. I can't tell you how many times I have located a desired book at
a yard sale or similar only to discover the disc is gone. )-:
Please save your
future recipients from that disappointment and keep the disc with the book or
package.
45/ Reconsider Before Discarding Corrupted
Discs. Those discs may not actually be
corrupted. If you have portable drives such as an external floppy, zip or hard
drive, and carry the drives and their discs in cold weather, they may need to
be warmed and dehumidified before usage. Using them while they are cold or
immediately after bringing them into a warm area, one may encounter faulty
reads and assume a corrupted disc or drive. Moisture can condense on heads and
exposed discs during ambient temperature changes. Wait until the drives/discs
have warmed and moisture has evaporated before trying again.
If the discs still won't read properly, try
using a recovery utility to revive them. I use Norton Utilities' DISKTOOL
program and have brought back information I thought was lost.
46/ Become Aware of all of a Program's
Capabilities. This includes your
operating system and accompanying utilities. Too often I have seen, or heard
of, users purchasing new software or upgrading to newer versions so as to
obtain some desired capability before they have reviewed what is already in
their own libraries. I frequently get comments about the age of some of the
programs I use until I explain that despite the eras of those programs, I use
them because they already have the capabilities required for modern tasks.
Marketers will hate this, but why change if it does what I want?
To this end, if you discover some fresh
interest that has resulted in new task requirements, look through your current
softwares' manuals or on-screen help systems to see if some or all of that
required capability is already available. If so, it has saved you money on, and
time spent learning, a new program!
47/ Assign Batch Files to Keys. For batch files you use most frequently,
assign them to function keys. Or if you wish to preserve those keys for DOSKEY
or other utilities, have the batch files run via Alt-Letter keys. This saves
typing even short batch file names over & over. Just saving these few
keystrokes makes a huge difference during lengthy computer sessions. I have
used them for so long, that they are as commands themselves and are intuitive
within my day-to-day computing chores. Keys may be reassigned from within DOS
by using PROMPT or ECHO commands, or via ANSIPLUS, DOSKEY, 4DOS, TODDY, or a
similar utility. I use ANSIPLUS.
ASSIGNED-KEY
EXAMPLES:
Coming up are just a few of the reassigned
keys that I use to implement batch files and utilities while working in DOS.
Some of them work under specific circumstances, but I won't get into those
here. Nor will I discuss what is going on behind these commands. I just want
these descriptions to give you an idea of the capabilities I have available by
using this method. I hope they will inspire you to use more time-saving
keystrokes in your daily computer operations.
Since all my key reassignments are in
memory, and so is every batch file and the DOS commands they call upon, these
execute instantly. I love to watch a GUI (Graphic User Interface) user's jaw
drop when he or she sees how fast things happen using this method - even on
slower processors. You've heard the term: "Greased Lightning" ? Well,
this setup is Teflon Lightning! (-:
Here we go...
F1 invokes my DR-DOS "Help"
system, while Alt-F1 adds a space and `/?' on the command line, and presses
"Enter" for me. That's great when I need to get a fast list of
switches for any command. I hated having to type that space, `/?' and
"Enter" after a command name every time, so I programmed that
sequence to a function key.
In a similar fashion, I programmed Alt-8 to
type `*.*' because I hated typing that all the time too. Note that the asterisk
is above the `8' on the number row above the alphabet keys, hence my reasoning
for using that key to invoke the macro.
Control-F1 clears the screen. It saves
typing "CLS" and hitting "Enter". Control-F2 clears the
screen and presents a wide-format, alphabetical listing of the current
directory with each file type in a different colour. Control-F3 returns to the
root directory of the current drive, clears the screen, and presents a colour
directory listing of files there.
Alt-d and Alt-u go to my DOWNLOAD or UPLOAD
directories, which I use constantly while on and off line. A list of files is
then displayed alphabetically in wide format with each file type in a different
colour.
I often play audio CDs when I am at the
computer. To gain maximum memory efficiency, I usually don't leave the player
program in memory. Instead, I have it able to be started via a batch file that
I then assigned to Alt-c. It's a simple matter to shell out of a program, hit
Alt-c, adjust the volume or change the disc or track number, exit the CD
program, and then type "EXIT" to return to my program.
But wait!
That's just not good
enough.
Let's go farther:
I also assigned "EXIT" to Alt-x,
so I don't even have to type that. Also, I have the batch file that is keyed to
Alt-c, set up to automatically unload the player program from memory, so I
preserve maximum memory. Once the CD is playing, it will continue until it
receives another command, so the program is not required to be in memory during
playback.
but..., you think: There's still a lot of
typing to shell out of one program, start the CD program, and then return to
where you were.
You are absolutely correct. That's why I
assigned a key macro within those programs to automatically shell out and start
the CD program. When I exit the CD program, I am automatically returned to
where I was working with no further input required from me. So, with one
keystroke, I am in the CD program, and one more in the CD program will exit,
remove it from memory, and return me to where I was.
Should I ever need to go to the CD a lot, I
could still simply leave it in memory and have direct access to it all the time
through its own hot keys. The point is I have a variety of choices - all of
which are fast & efficient, and not a desk rodent in sight. (-:
I use Alt-v to load the listing of the
current directory into my file viewer from which I may select one to look at. I
use Central Point's VIEW.exe for this. It comes with PC Tools and is capable of
showing text, spreadsheet, database, word processing and other files types from
a variety of software manufacturers. (There are other file viewers available that
allow manipulation of the files, as well.) File viewing from the command line
is extra handy because I don't need to load the original program if all I need
is to quickly look at a particular file.
Alt-g starts a simple graphics viewer in
any directory for a quick look at any .bmp, .gif, .jpg, .pcx, .tga, etc file.
Alt-r returns to my desktop and resets to
my standard prompt, colour scheme, cursor size & flash rate, and text type.
F9 is my Auto-Complete key. I type the
first few letters of a directory or executable file name in the current
directory, press F9 and that name will be completed. It is directory aware so
that I can auto complete a directory name, add a backslash and a letter, and it
will auto complete a subdirectory name within that directory regardless of the
drive on which it resides. Finishing up, I can type a few letters of a file
name within that remote directory and it too will be completed.
In addition, I can type a command such as
REN, the first few letters of a file, then F9, and the file name I wish to
change is completed for me. This is done for me via Toddy, a command-line
utility similar to DOSKEY, but much more powerful. Toddy also allows me to type
the first few letters of a previous command, hit TAB and it will be completed
automatically as well.
F10 displays the current directory in wide
format, alphabetical order, and with each file type in a different colour.
F11 tags a directory to which I wish to
return. F12 returns me there whenever I want, from any drive or directory,
anywhere on my computer. This can occur even after a reboot! When returned, a
list of the files in that directory is displayed. (See "RETURN.bat"
in Advanced Batch Files for a look at how the F11 & F12 batch files work.)
In addition, I have three other key
assignments that can be programmed to return to any one of three directories.
These are programmed on the fly so that when in any directory, I can hit
Alt-Delete, Alt-End, or Alt-Page Down, to tag a directory, To return to any of
the three, I hit the equivalent key but instead coupled with the Control key.
So as an example, to tag a directory, I can hit Alt-End and to return to it I
press Control-End. These three are independent of the F11 & F12 keys
described above. I use these three assignments during operations in which I
need fast access among several directories - regardless of the drive on which
those directories reside. These assignments also survive reboots.
In keeping with the above, Control-F12
toggles back & forth between the current and last directory accessed. This
changes as I change directories, so that if I am in my E:\GRAPHICS directory
and wish to change to my C:\UTIL directory, I do so via whatever method I
choose. Then I can hit Control-F12 to return to E:\GRAPHICS. If however, while
in E:\GRAPHICS, I change to E:\TEST, pressing Control-F12 still returns me to
C:\UTIL, but pressing Control-F12 again now returns me to the new `last'
directory: E:\TEST.
I call this the last example the `A-B' method.
The idea was taken from television remote controls that work in the same
manner. To explain further: If one is on Channel 3 and wishes to change to
Channel 29, `29' is pressed. Hitting the `Recall' button returns one to Channel
3. Further, if one is on 3, goes directly to 29, as above, and while there
presses the `Up' button to check the temperature on Channel 30, then presses
the `Down' button to return to 29, hitting the recall button still returns one
to channel 3 and not 30. This is because the `A' side of the `Recall' operation
was never changed from Channel 3 to something else.
Essentially, Channel 3 was programmed into
the `A' side of the `Recall' operation, while 29 was programmed to the `B'
side. Moving from 29 to 30 and back again via the `Up' and `Down' buttons only
changed the `B' side. If the remote had been left on Channel 30 and the
`Recall' button pressed to go to Channel 3 then pressed again, Channel 30 would
have been the result. Thus pressing `Recall" at any time always returns one
to the channel programmed into the opposite slot. In this case, it will be
Channel 3 until one either changes 3 by moving up or down and staying at the
new channel or by directly entering another number while on Channel 29. Sadly,
few remotes work this way any more. They all want to return to the immediately
previous channel even if using the `Up' and `Down' buttons. )-:
Getting back to my computer setups, this,
and the previous `Directory Return' macros, are examples of dynamic batch file
writing in which additional batch files are actually being written (or
rewritten) in the background as I press various keys. Each is then ready to
return me to where ever I was last, or to any of several directories I had
chosen previously. These extra batch files allow me to access information about
these changing key assigments and to display them on screen at the touch of a
key macro.
Although I won't go into detail here, I use
the same technique for a number of other operations such as file editing. Regarding
the latter, additional batch files are automatically written during file
viewing that will automatically place the name of the most recent one viewed
into a batch file so I can edit it should I choose. In all cases, these
"sister" batch files track along with the primary ones in that they
change as do the primary ones while I work.
Alt-i moves down one level into an IMAGES
directory and shows a list. I have many directories containing files that have
associated images. This is especially true with my Internet html directories.
Whenever I am in any of those directories, a simple ALT-i immediately places me
in the images directory associated with those .htm files. To then view any
graphic image, I can press ALT-g, as mentioned farther back.
Alt-k. Similar to the above Alt-i, this
shortcut moves down one level into a WORK directory and displays any files
contained therein. As with the IMAGES directories, I often create WORK
subdirectories within many directories. I copy files to the WORK from its
parent directory when I wish to preserve a parent directory file as-is until I
replace it with the version being worked upon.
This allows me to keep the parent directory
uncluttered. Plus, one quick check of any work directory immediately shows me if
I have anything on going. The Alt-k shortcut allows this quick check in an
effortless way. (I don't use `Alt-w' for this macro because that is programmed
to start my word processor.)
Control-l invokes a small DOWN utility that
moves down one level to the first available subdirectory. To go to the next
sister directory, I have Control-n run a NEXT utility. This way, I can move
into each subdirectory in a list without ever having to type the path or even
the directory name! Alt-l moves up one level to the next highest directory.
With a combination of the above three, I
can move up & down my directory structure at will just by Alt and Control
key combinations - again never having to type a path or directory name, should
I so choose. In all cases, the directory contents are displayed in alphabetical
order, wide format with different colours for each file type. I often employ
these after using the Alt-i or Alt-k shortcuts, to quickly return me to the
parent directory or move to an adjacent or lower directory.
Alt-z expands any .zip files in the current
directory. It keeps the zip file, but my varied key reassignment, Control-z,
expands the contents and deletes the .zip file afterwards.
Control-f deletes all files in the current
directory with absolutely no questions or prompts. BANG! All gone! An automatic
listing after the operation confirms the directory is empty.
That was just a small
sampling of the many keyboard reassignments
I have at hand. They
do all of my repetitive work and much of the
less typical work I
do at the computer. Initially, there was some
thinking involved to
recall them all, so of course, I wrote a batch
file to list the
macros, in case I forget. (-:
After a while, the
key shortcuts become so ingrained that one
no longer really
thinks about them. At that point, one becomes
a true power user and
can run circles around any GUI interface.
...and now, one final tip:
48/ Buy DOS Books. DOS has been around long enough that many
publications are easily available in used books stores at excellent prices. You
don't necessarily need one geared to your DOS version because, despite
differences, DOS versions have remained true to one another. A good library of
books is a must if you are thinking of becoming a power user, or just wish to
improve your DOS operating system knowledge. See this website's DOS
Publications section to get started.
Be sure to try to find books with included
discs. Many will have very useful utilities - even for today. Remember, because
DOS has remained true to itself, old DOS programs will run on new versions and
new software will run on old DOS versions at least since 1991. This is with few
exceptions.
1 comment:
Many blog and article sites provide features for readers to leave comments and engage in discussions. Unlock For VPN Traffic This fosters a sense of community and encourages interaction between content creators and their audience, allowing for valuable feedback and the exchange of ideas.
Post a Comment