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 ACCOUNTSNT: Displays password rules for current account
NET COMPUTERNT: 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 FILENT
NET GROUPNT
NET HELP Provides information about commands and error messages.
NET HELPMSGNT: 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 LOCALGROUPNT
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 NAMENT
NET PASSWORD Changes your logon password.
NET PAUSENT
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 SESSIONNT
NET SHARENT
NET START Starts services.
NET STATISTICSNT
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 USERNT: 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:
PartitionStatus TypeVolume Label MbytesSystem Usage
C: 1A PRI DOS7545 FAT3279%

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.