Useful DOS commands (mainly for newbies)



all commands typed at DOS prompt:
_________________________________

ANSWER TO PING OFF: echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

ANSWER TO PING ON : echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
--------------------------------------------------------------------------------------------
TRACE NETWORK : tracert [-d][-h maximum_hops][-j host-list][-w
timeout]target_name
PACKET/SITE TO IP
-d : do not resolve addresses to hostnames
-h maximum_hops : maximum number of hops to search for
target
-j host-list : loose source route along host-list
-w timeout : wait timeout milliseconds for each reply
--------------------------------------------------------------------------------------------
PING HOST/IP : ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v
TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] destination-list

Options:
-t Pings the specified host until stopped.
To see statistics and continue - type Control-Break;
To stop - type Control-C.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-l size Send buffer size.
-f Set Don't Fragment flag in packet.
-i TTL Time To Live.
-v TOS Type Of Service.
-r count Record route for count hops.
-s count Timestamp for count hops.
-j host-list Loose source route along host-list.
-k host-list Strict source route along host-list.
-w timeout Timeout in milliseconds to wait for each reply.
--------------------------------------------------------------------------------------------

CHANGE IP ON A
NETWORK CARD : ARP -s inet_addr eth_adr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]

-a :Displays current ARP entries by interrogating the current protocol data.
If inet_addr is specified, the IP and Physical addresses for
only the specified computer are displayed. If more than one network
interface uses ARP, entries for each ARP table are displayed.
-g : Same as -a
inet_addr : Specifies an internet address.
-N if addr : Displays the ARP entries for the network interface specified
by if_addr.
-d : Deletes the host specified by inet_addr.
-s : Adds the host and associates the Internet address inet_addr with the
Physical address eth_addr. The Physical address is given
as 6 hexadecimal bytes seperated by hyphens. The entry is permanent.
eth_addr : Specifies a physical address
if_addr : If present, this specifies the Internet address of the interface
whose address translation table should be modified.
If not present, the first applicable interface will be used.
--------------------------------------------------------------------------------------------

DISPLAY OR CHANGE
FILE ATTRIBUTES : ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H]
[[drive:][path]filename] [/S]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.
--------------------------------------------------------------------------------------------
VIEW A NETWORK Using NET.exe
/NETWORK SETTINGS : NET CONFIG Displays your current workgroup settings.
NET CONFIG [/YES]

/YES Carries out the NET CONFIG command without
first prompting you to provide information or
confirm actions.

NET DIAG Runs the Microsoft Network Diagnostics program to test the hardware
connection between two computers and to
display information about a single computer.

NET DIAGNOSTICS [/NAMES | /STATUS]

/NAMES Specifies a diagnostic server name in order to avoid conflicts when
NET DIAG is used simultaneously by multiple
users. This option works only when the network uses a NetBIOS
protocol.
/STATUS Enables you to specify a computer about which you want network
diagnostics information.


NET HELP Displays information about NET commands and error messages.
command /?
NET HELP [suffix]
NET HELP errornum


command /? -Specifies the Microsoft NET command that you want information
about.
suffix -Specifies the second word of the command you want information
about. For example, the suffix of NET VIEW is VIEW.
errornum -Specifies the number of the error message that you want
information about.


NET INIT Loads protocol and network-adapter drivers without binding them to
Protocol Manager. This command may be required
if you are using a third-party network-adapter driver. You can then bind the
drivers to Protocol Manager by typing
NET START NETBIND.
NET INITIALIZE [/DYNAMIC]

/DYNAMIC Loads the Protocol Manager dynamically. This is useful with some
third-party networks, such as
Banyan(R) VINES(R), to resolve memory problems.


NET LOGOFF Breaks the connection between your computer and the shared
resources to which it is connected.
NET LOGOFF [/YES]

/YES Carries out the NET LOGOFF command without first prompting you to
provide information or confirm actions.

NET LOGON Identifies you as a member of a workgroup.
NET LOGON [user [password | ?]] [/DOMAIN:name] [/YES] [/SAVEPW:NO]

user- Specifies the name that identifies you in your workgroup. The name you
specify can contain up to 20 characters.
password -The unique string of characters that authorizes you to gain access
to your password-list file. The password
can contain up to 14 characters.
? -Specifies that you want to be prompted for your password.
/DOMAIN -Specifies that you want to log on to a Microsoft Windows NT or LAN
Manager domain. name Specifies the Windows NT
or LAN Manager domain you want to log on to.
/YES -Carries out the NET LOGON command without first prompting you to
provide information or confirm actions.
/SAVEPW:NO Carries out the NET LOGON command without prompting you to
create a password-list file.

If you would rather be prompted to type your user name and password instead
of specifying them in the NET LOGON command
line, type NET LOGON without options.

NET PASSWORD Changes your logon password.
NET PASSWORD [oldpassword [newpassword]]
NET PASSWORD \\computer | /DOMAIN:name [user [oldpassword [newpassword]]]

oldpassword -Specifies your current password.
newpassword -Specifies your new password. It can have as many as 14
characters.
computer -Specifies the Windows NT or LAN Manager server on which you want
to change your password.
/DOMAIN -Specifies that you want to change your
password on a Windows NT or LAN Manager domain.
name -Specifies the Windows NT or LAN Manager domain on which
you want to change your password.
user -Specifies your Windows NT or LAN Manager user name.

The first syntax line above is for changing the password for your
password-list file. The second syntax line above is
for changing your password on a Windows NT or LAN Manager server or domain.

NET PRINT Displays information about print queues and controls print jobs.
NET PRINT \\computer[\printer] | port [/YES]
NET PRINT \\computer | port [job# [/PAUSE | /RESUME | /DELETE]] [/YES]

computer -Specifies the name of the computer whose print queue you want
information about.
printer -Specifies the name of the printer you want information about.
port -Specifies the name of the parallel (LPT) port on your computer that is
connected to the printer you want
information about.
job# -Specifies the number assigned to a queued print job. You can specify
the following options:
/PAUSE -Pauses a print job.
/RESUME -Restarts a print job that has been paused.
/DELETE -Cancels a print job.
/YES -Carries out the NET PRINT command without first prompting you to
provide information or confirm actions.

When you specify the name of a computer by using the NET PRINT command, you
receive information about the print queues
on each of the shared printers that are connected to the computer.

NET START Starts services. NOTE: Services cannot be started from a command
prompt within Windows.
NET START [BASIC | NWREDIR | WORKSTATION | NETBIND | NETBEUI | NWLINK]
[/LIST] [/YES] [/VERBOSE]

BASIC Starts the basic redirector.
NWREDIR Starts the Microsoft Novell(R) compatible redirector.
WORKSTATION Starts the default redirector.
NETBIND Binds protocols and network-adapter drivers.
NETBEUI Starts the NetBIOS interface.
NWLINK Starts the IPX/SPX-compatible interface.
/LIST Displays a list of the services that are running.
/YES Carries out the NET START command without first prompting you to
provide information or confirm actions.
/VERBOSE Displays information about device drivers and services as they are
loaded.

To start the workgroup redirector you selected during Setup, type NET START
without options. In general, you don't need
to use any of the options.

NET STOP Stops services. NOTE: Services cannot be stopped from a command
prompt within Windows.

NET STOP [BASIC | NWREDIR | WORKSTATION | NETBEUI | NWLINK] [/YES]

NET STOP Stops the basic redirector.
BASIC Stops the basic redirector.
NWREDIR Stops the Microsoft Novell(R) compatible redirector.
WORKSTATION Stops the default redirector.
NETBEUI Stops the NetBIOS interface.
NWLINK Stops the IPX/SPX compatible interface.
/YES Carries out the NET STOP command without first prompting you to provide
information or confirm actions.

To stop the workgroup redirector, type NET STOP without options. This breaks
all your connections to shared resources
and removes the NET commands from your computer's memory.

NET TIME Displays the time on or synchronizes your computer's clock with the
shared clock on a Microsoft Windows for Workgroups,
Windows NT, Windows 95, or NetWare time server.
NET TIME [\\computer | /WORKGROUP:wgname] [/SET] [/YES]

computer -Specifies the name of the computer (time server) whose time you
want to check or synchronize your computer's
clock with.
/WORKGROUP Specifies that you want to use the clock on a computer (time
server) in another workgroup.
wgname -Specifies the name of the workgroup containing a computer whose
clock you want to check or synchronize your computer's clock with.
If there are multiple time servers in that workgroup, NET TIME uses the
first one it
finds.
/SET Synchronizes your computer's clock with the clock on the computer or
workgroup you specify.
/YES Carries out the NET TIME command without first prompting you to provide
information or confirm actions.

NET USE Connects or disconnects your computer from a shared resource or
displays information about your connections.
NET USE [drive: | *] [\\computer\directory [password | ?]]
[/SAVEPW:NO] [/YES] [/NO]
NET USE [port:] [\\computer\printer [password | ?]]
[/SAVEPW:NO] [/YES] [/NO]

NET USE drive: | \\computer\directory /DELETE [/YES]
NET USE port: | \\computer\printer /DELETE [/YES]
NET USE * /DELETE [/YES]

NET USE drive: | * /HOME

drive -Specifies the drive letter you assign to a shared directory.
* -Specifies the next available drive letter. If used with /DELETE,
specifies to disconnect all of your connections.
port -Specifies the parallel (LPT) port name you assign to a shared printer.
computer -Specifies the name of the computer sharing the resource.
directory -Specifies the name of the shared directory.
printer -Specifies the name of the shared printer.
password -Specifies the password for the shared resource, if any.
? -Specifies that you want to be prompted for the password of the shared
resource. You don't need to use this option
unless the password is optional.
/SAVEPW:NO Specifies that the password you type should not be saved in your
password-list file. You need to retype the password the
next time you connect to this resource.
/YES Carries out the NET USE command without first prompting you to provide
information or confirm actions.
/DELETE Breaks the specified connection to a shared
resource.
/NO Carries out the NET USE command, responding with NO automatically when
you are prompted to confirm actions.
/HOME Makes a connection to your HOME directory if one is specified in your
LAN Manager or Windows NT user account.

To list all of your connections, type NET USE without options.


NET VER Displays the type and version number of the workgroup redirector you
are using.
NET VER

NET VIEW Displays a list of computers in a specified workgroup or
the shared resources available on a specified computer.
NET VIEW [\\computer] [/YES]
NET VIEW [/WORKGROUP:wgname] [/YES]

computer -Specifies the name of the computer whose shared resources you want
to see listed.
/WORKGROUP Specifies that you want to view the names of the computers in
another workgroup that share resources.
wgname -Specifies the name of the workgroup whose computer names you want to
view.
/YES Carries out the NET VIEW command without first prompting you to provide
information or confirm actions.

To display a list of computers in your workgroup that share
resources, type NET VIEW without options.
--------------------------------------------------------------------------------------------

DEBUG : DEBUG [[drive:][path]filename [testfile-parameters]]

[drive:][path]filename Specifies the file you want to test.
testfile-parameters Specifies command-line information required by the
file you want to test.

***After Debug starts, type ? to display a list of debugging commands.***

To get out of Debug you need to "Q" and enter
To execute the Debug routine you need to do "G" and enter

--------------------------------------------------------------------------------------------
IPCONFIG : ipconfig [/all][/batch][/renew_all][/release_all][/renew
N][/release N]

/All Display detailed information.
/Batch [file] Write to file or ./WINIPCFG.OUT
/renew_all Renew all adapters.
/release_all Release all adapters.
/renew N Renew adapter N.
/release N Release adapter N.
--------------------------------------------------------------------------------------------
FTP : Depending upon the version of FTP and the Operating System being
used each of the following commands may or may
not work. Generally typing -help or a ? will list the commands
available to you.

Command Information

! : Using this command you will have the capability of toggling back and
forth between the operating system and ftp.
Once back in the Operating System generally typing exit will take you
back to the FTP command line.
? : Access the Help screen.
abor : Abort Transfer
append : Append text to a local file.
ascii : Switch to ASCII transfer mode
bell : Turns bell mode on / off.
binary : Switches to binary transfer mode.
bye : Exits from FTP.
cd : Changes directory.
cdup : Change to parent directory on remote system
close : Exits from FTP.
cwd : Change working directory on remote system
dele : Delete file on remote system
delete : Deletes a file.
debug : Sets debugging on / off.
dir : Lists files if connected.
dir -C = Will list the files in wide format.
dir -1 = Lists the files in bare format in alphabetic order
dir -r = Lists directory in reverse alphabetic order.
dir -R = Lists all files in current directory and sub directories.
dir -S = Lists files in bare format in alphabetic order.
disconnect : Exits from FTP.
get : Get file from the computer connected to.
glob : Sets globbing on / off.
hash : Sets hash mark printing on / off
help : Access the Help screen and displays information about command if
command typed after help.
lcd : Displays local directory or if path typed after lcd will change local
directory.
list : Send a list of file names in the current directory on the remote
system on the data connection.
literal : Sends command line
ls : Lists files if connected.
mdelete : Multiple delete
mdir : Lists contents of multiple remote directories
mget : Get multiple files
mkd : Make directory.
mkdir : Make directory.
mls : Lists contents of multiple remote directories.
mode : Specifies the transfer mode. Available parameters are generally S, B
or C.
mput : Sent multiple files
nlst : Send a full directory listing of the current directory on the remote
system on the data connection.
open : Opens address.
pass : Supplies a user password.
port : Specify the client port number.
prompt : Enables disables prompt.
put : Send one file
pwd : Print working directory
quit : Exits from FTP.
quote : Send arbitrary ftp command
recv : Receive file
retr : Get file from remote system.
remotehelp : Get help from remote server
rename : Renames a file
rmdir : Removes a directory
send : Send single file
status : Shows status of currently enabled / disabled options
trace : Toggles packet tracing
type : Set file transfer type
user : Send new user information
verbose : Sets verbose on / off.
--------------------------------------------------------------------------------------------

DISPLAY TCP/IP
NETWORK PROTOCOL : NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]
INFORMATION

-a Displays all connections and listening ports.
-e Displays Ethernet statistics. This may be combined with the -s option.
-n Displays addresses and port numbers in numerical form.
-p proto -Shows connections for the protocol specified by proto; proto may
be TCP or UDP. If used with the -s option
to display per-protocol statistics, proto may be TCP, UDP, or IP.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics are shown for
TCP, UDP and IP; the -p option may be used
to specify a subset of the default.
interval Redisplays selected statistics, pausing interval seconds between
each display. Press CTRL+C to stop
redisplaying statistics. If omitted, netstat will print the current
configuration information once.
--------------------------------------------------------------------------------------------

DISPLAY OR SET A SEARCH PATH FOR EXECUTABLE FILES :

PATH [[drive:]path[;...]]
PATH ;

Type PATH ; to clear all search-path settings and direct Windows to search
only in the current directory.
Type PATH without parameters to display the current path.
--------------------------------------------------------------------------------------------

MANUALLY CONFIGURE MODEMS ROUTE :

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. When used with the PRINT
command, displays the list of registered
persistent routes. Ignored for all other commands, which always affect
the appropriate persistent routes. This option
is not supported 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: 87

EXAMPLES

Examples:

>route PRINT

>route ADD 157.0.0.0
^destination
MASK 255.0.0.0
^mask 157.55.80.1
^gateway METRIC 3
^metric IF 2
^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

One way to use this would be as follows: You can't ping the server that you
are connecting to, but you know the ip address
to be 127.16.16.10

>route PRINT

Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 14 a4 c3 44 20 ...... Xircom CardBus Ethernet 10/100 Adapter
0x3 ...00 b0 d0 43 55 a5 ...... 3Com EtherLink PCI
0x4 ...00 01 b0 8f 8f 80 ...... NdisWan Adapter

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 127.16.8.14 127.16.8.14 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
127.16.0.0 255.255.0.0 127.16.8.14 127.16.8.14 1
127.16.8.14 255.255.255.255 127.0.0.1 127.0.0.1 1
192.168.50.0 255.255.255.0 192.168.50.65 192.168.50.65 2
192.168.50.65 255.255.255.255 127.0.0.1 127.0.0.1 1
192.168.50.255 255.255.255.255 192.168.50.65 192.168.50.65 1
224.0.0.0 224.0.0.0 127.16.8.14 127.16.8.14 1
224.0.0.0 224.0.0.0 192.168.50.65 192.168.50.65 1
255.255.255.255 255.255.255.255 192.168.50.65 192.168.50.65 1

** notice that no gateway for the current ip goes to 255.255.255.0, so it
must be added. Now do the following command:

>route ADD 127.16.0.0 MASK 255.255.255.0 <your current ip from winntcfg or
>winipcfg> METRIC 1

**Then do the following command:

>route print

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 127.16.8.14 127.16.8.14 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
127.16.0.0 255.255.0.0 127.16.8.14 127.16.8.14 1
** 127.16.0.0 255.255.255.0 127.16.8.14 127.16.8.14 1
127.16.8.14 255.255.255.255 127.0.0.1 127.0.0.1 1
192.168.50.0 255.255.255.0 192.168.50.65 192.168.50.65 2
192.168.50.65 255.255.255.255 127.0.0.1 127.0.0.1 1
192.168.50.255 255.255.255.255 192.168.50.65 192.168.50.65 1
224.0.0.0 224.0.0.0 127.16.8.14 127.16.8.14 1
224.0.0.0 224.0.0.0 192.168.50.65 192.168.50.65 1
255.255.255.255 255.255.255.255 192.168.50.65 192.168.50.65 1


**Notice the ** ip address gives you the default gateway.
--------------------------------------------------------------------------------------------

DISPLAY PROTOCOL STATISTICS
AND CURRENT TCP/IP CONNECTIONS
USING NBT(NETBIOS OVER TCP/IP): NBTSTAT [-a RemoteName] [-A IP address]
[-c] [-n]
[-r] [-R] [-s] [S] [interval] ]

-a (adapter status): Lists the remote machine's name table given its name
-A (Adapter status): Lists the remote machine's name table given its IP
address
-c (cache) : Lists the remote name cache including the IP addresses
-n (names) : Lists local netBIOS names
-r (resolved) : Lists names resolved by broadcast and via WINS
-R (Reload) : Purges and reloads the remote cache name table
-S (Sessions) : Lists sessions table with the destination IP addresses
-s (sessions) : Lists sessions table converting destination IP
addresses
to host names via the hosts file

RemoteName Remote host machine name.
IP address Dotted decimal representation of the IP address.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press Ctrl+C to stop redisplaying
statistics.
--------------------------------------------------------------------------------------------

-END-




Credits


written by: i.System