More MSdos Commands

Prerequisites: 

Windows OS, half a brain

More DOS Commands! Because the world is full of Nublets!

dir
List current contents of the directory you are in.

ex:
C:\>dir
Volume in drive C has no label.
Volume Serial Number is 086B-C6A2

Directory of C:\

11/25/2007 07:08 AM 38a7818136fc935fc6
11/25/2007 01:43 AM 0 AUTOEXEC.BAT
02/23/2008 09:30 PM backups
11/25/2007 01:43 AM 0 CONFIG.SYS
12/30/2007 05:09 AM cygwin
02/23/2008 11:36 PM Dev-Cpp
11/25/2007 01:51 AM Documents and Settings
03/10/2008 01:28 AM drivers
01/20/2008 01:32 AM 55 DVDPATH.TXT
11/25/2007 03:46 AM EXCEED
02/23/2008 08:30 PM gtk
11/25/2007 01:56 AM Inetpub
03/09/2008 08:54 PM Program Files
12/30/2007 01:30 AM 512 ScanSectorLog.dat
03/15/2008 07:52 PM WINDOWS
12/01/2007 05:54 AM WINNT
4 File(s) 567 bytes
12 Dir(s) 25,193,529,344 bytes free

type
List the contents of a file (normally a text file).

ex:
C:\> type boot.ini
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Micro$haft Winblows XP Professionals"
/fastdetect /NoExecute=OptIn

cls
Clears the text that is displayed currently on the screen.

ex:
(only shows you're command prompt)

copy
Copies files from one location to another.

ex:
C:\>copy test.txt test
1 file(s) copied.

ping
Ping sends a small packet of data from your computer to another machine, computer, router, switch, etc..
and returns back information based on whether that machine is online or offline.
Information that is returned can be an ip address (if a hostname was given), the time it took for the
data to be sent and returned back, etc..

ex:
C:\>ping localhost

Pinging neotek [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

ftp
Logs you into an ftp site that you input.

ex:
C:\>ftp localhost
Connected to neotek.
220 Microsoft FTP Service
User (neotek:(none)): cisc0ninja
331 Password required for cisc0ninja.
Password:
230 User cisc0ninja logged in.
ftp>

cd
Changes the current directory that you're in to what you want to be in.

ex:
C:\Documents and Settings>cd ..
C:\>

mkdir
Makes a directory that you name.

ex:
C:\>mkdir test

set, setlocal, path
Used for showing or setting environmental variables.

ex:
C:\>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\cisc0ninja\Application Data
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=NEOTEK
ComSpec=C:\WINDOWS\system32\cmd.exe
CYGWIN=tty ntsec
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\cisc0ninja
LOGONSERVER=\\NEOTEK
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Wi
nSCP\;"C:\Program Files\Zone Labs\ZoneAlarm\MailFrontier";c:\gtk\bin;C:\Program
Files\Symantec\pcAnywhere\;C:\Program Files\Common Files\Nero\Lib\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 36 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=2402
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\cisc0ninja\LOCALS~1\Temp
TMP=C:\DOCUME~1\cisc0ninja\LOCALS~1\Temp
tvdumpflags=8
USERDOMAIN=NEOTEK
USERNAME=d0cipx
USERPROFILE=C:\Documents and Settings\cisc0ninja
windir=C:\WINDOWS

nslookup
List dns information about a certain domain. Possibly used to obtain dns records from a server that has been misconfigured.

ex. (the ls -d (domain name) would list the dns records if it's unsecure)
C:\>nslookup
Default Server: neotek.soldierx.com
Address: 10.10.10.15

> ls -d soldierx.com
[neotek.soldierx.com]

netstat
Displays active connections, services running, their protocols, and their listening ports

ex:
C:\>netstat -a

Active Connections

Proto Local Address Foreign Address State
TCP neotek:echo 0.0.0.0:0 LISTENING
TCP neotek:discard 0.0.0.0:0 LISTENING
TCP neotek:daytime 0.0.0.0:0 LISTENING
TCP neotek:qotd 0.0.0.0:0 LISTENING
TCP neotek:chargen 0.0.0.0:0 LISTENING
TCP neotek:ftp 0.0.0.0:0 LISTENING
TCP neotek:smtp 0.0.0.0:0 LISTENING
TCP neotek:http 0.0.0.0:0 LISTENING
TCP neotek:epmap 0.0.0.0:0 LISTENING
TCP neotek:https 0.0.0.0:0 LISTENING
TCP neotek:microsoft-ds 0.0.0.0:0 LISTENING
TCP neotek:1025 0.0.0.0:0 LISTENING
TCP neotek:1026 0.0.0.0:0 LISTENING
UDP neotek:echo *:*
UDP neotek:discard *:*
UDP neotek:daytime *:*
UDP neotek:qotd *:*
UDP neotek:chargen *:*
UDP neotek:snmp *:*
UDP neotek:microsoft-ds *:*
UDP neotek:isakmp *:*
UDP neotek:3456 *:*
UDP neotek:4500 *:*
UDP neotek:ntp *:*
UDP neotek:1900 *:*

telnet

ex:
C:\Documents and Settings\cisc0ninja>telnet
Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet> open localhost
Connecting To localhost...
You are about to send your password information to a remote computer in Internet
zone. This might not be safe. Do you want to send anyway(y/n):n
*===============================================================
Welcome to Microsoft Telnet Server.
*===============================================================
C:\Documents and Settings\cisc0ninja>

tracert
Traces the route between yourself and a given host(machine, router, swithc, computer, blah)

ex:
C:\>tracert localhost

Tracing route to neotek [127.0.0.1]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms localhost [127.0.0.1]

Trace complete.

nbtstat
Displays current layer 2 routing information such as mac addresses and possibly usernames and share drives/locations.

ex:
C:\>nbtstat -A 10.10.10.15

Local Area Connection:
Node IpAddress: [10.10.10.15] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
INet~Services <1C> GROUP Registered
IS~neotek .<00> UNIQUE Registered
neotek <00> UNIQUE Registered
neotek <03> UNIQUE Registered
soldierx <00> GROUP Registered
neotek <20> UNIQUE Registered
X90ITS <1E> GROUP Registered
SOLDIERX <1D> UNIQUE Registered
..__MSBROWSE__.<01> GROUP Registered
BLEH <03> UNIQUE Registered
ADMINISTRATOR <03> UNIQUE Registered
ROOT <03> UNIQUE Registered

MAC Address = 00-02-A5-D4-E6-20

net
Net doesn't do anything on it's own other than give you a list of commands to use with it.
Those other commands do many various things. (Some are listed below)

ex:
C:\>net
The syntax of this command is:

NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]

ipconfig
(or ipconfig /all)
List the ip address and possibly dns servers, default gateway, etc..
used for networking your computer up with others, or the net.

ex:

C:\>ipconfig /all

Windows 2000 IP Configuration

Host Name . . . . . . . . . . . . : neotek
Primary DNS Suffix . . . . . . . : soldierx.com
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : soldierx.com
x90its.com

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Compaq NC3163 Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-02-A5-D4-E6-20
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 10.10.10.15
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.10.10.1
DNS Servers . . . . . . . . . . . : 10.10.10.50
10.10.10.75
Primary WINS Server . . . . . . . : 10.10.10.50
Secondary WINS Server . . . . . . : 10.10.10.75

net share
Gives information about network shares and allows you to add or delete them.

ex:
C:\>net share

Share name Resource Remark

-------------------------------------------------------------------------------
ADMIN$ C:\WINDOWS Remote Admin
C$ C:\ Default share
IPC$ Remote IPC
The command completed successfully.

C:\>net share /del admin$
admin$ was deleted successfully.

net localgroup administrators
Shows what usernames have admin privilages by being in the administrators group.

ex:
C:\>net localgroup administrators
Alias name administrators
Comment Administrators have complete and unrestricted access to the compu
ter/domain

Members

-------------------------------------------------------------------------------
Administrator
cisc0ninja
The command completed successfully.

netsh
netsh actually puts you into a different shell than your normal DOS command window.
It has it's own set of commands you can find by typing HELP after you enter it.
I normally use it in scripts to set a network interface to dhcp or staticly assign an ip address.

ex: (putting a question mark after things can show you more stuff)
c:\>netsh interface ip set address ?

Usage: set address [name=]
[[source=]dhcp |
[source=] static [addr=]IP address [mask=]IP subnet mask]
[[gateway=]|none [gwmetric=]integer]

Parameters:

Tag Value
name - The name of the interface.
source - One of the following values:
dhcp: Sets DHCP as the source for configuring IP
addresses for the specific interface.
static: Sets the source for configuring IP addresses
to local static configuration.

gateway - One of the following values:
: A specific default gateway for the
static IP address you are setting.
none: No default gateways are set.
gwmetric - The metric for the default gateway. This field should
not be set if gateway is set to 'none'.
The following options are used only if source is 'static':

addr - An IP address for the specified interface.
mask - The subnet mask for the specified IP address.

Remarks: Used to change the IP address configuration mode from either DHCP to
static mode or static mode to DHCP. Adds IP addresses on an
interface with static IP address or adds default gateways.

Examples:

set address name="Local Area Connection" source=dhcp
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1

>
Operator which means "put this into this file and REPLACE whatever was in that file with this info".

ex:
C:\>type boot.ini > test.txt

>>
Operator which means "put this into this file and APPEND the information to the end of the file".

ex:
C:\>type boot.ini >> test.txt

|
Operator which means "do this command INSIDE/(at the same time or directly after) of this other command.

ex:(it first searches the directory for the file, then list the contents of the file)
C:\>dir | type test.txt
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional"
/fastdetect /NoExecute=OptIn
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional"
/fastdetect /NoExecute=OptIn

ex:2 (tree is not really all that useful unless you want to see all files and all directories;
but the "| more" at the end makes it 1 page at a time. Afterwards, the enter/return key goes line by line
and the spacebar goes page by page.

C:\>tree | more
Folder PATH listing
Volume serial number is 086B-C6A2
C:.
+---38a7818136fc935fc6
+---backups
+---cygwin
¦ +---bin
¦ +---cygdrive
¦ +---dev
¦ +---etc
¦ ¦ +---alternatives
¦ ¦ +---apache
¦ ¦ +---apache2
¦ ¦ ¦ +---conf.d
¦ ¦ ¦ +---extra
¦ ¦ ¦ +---original
¦ ¦ ¦ +---extra
¦ ¦ +---asciidoc
¦ ¦ ¦ +---docbook-xsl
¦ ¦ ¦ +---filters
¦ ¦ ¦ +---images
¦ ¦ ¦ ¦ +---icons
¦ ¦ ¦ ¦ +---callouts
¦ ¦ ¦ +---javascripts
-- More --

Reference: 

cisc0ninja's cranium