Windows XP Commands
Send email from the command line.
Syntax
MAPISEND -u "profile" -p password
-r recipient -s "subject" -m text message [options]
MAPISEND -u "profile" -p password
-r recipient -s "subject" -t text_file [options]
options
-i interactive login (prompts for profile and password)
-c cc: list
-f File Attachment - path and file name(s)
-v generates verbose output (an 8 line summary of the message)
"profile" is the profile name (user mailbox) of sender
"subject" is the subject line
"recipient" is one or more recipient(s)
If more than one recipient - separate with ';' these must not be ambiguous
in the default address book.
-------------------------------------------------------------------------------------
Mapisend requires MAPI - i.e the MS Outlook client needs to be installed.
Examples
mapisend -u "MS Exchange Settings" -p MyPassword -r billg@sun.com -s"The new electronic interdependence re-creates the world in the image of a global village" - Marshall McLuhan
"Subject" -m "Test message text"
mapisend -u "MS Exchange Settings" -p MyPassword -r billg@hp.com -s "Subject"
-t c:\MyMail.txt >> c:\mail.log
-------------------------------------------------------------------------------------------------
Display current TCP/IP network connections and protocol statistics.
Syntax
NETSTAT [options] [-p protocol] [interval]
Key
-a Display all connections and listening ports.
-e Display Ethernet statistics. (may be combined with -s)
-n Display addresses and port numbers in numerical form.
-r Display the routing table.
-o Display the owning process ID associated with each connection.
(XP only)
-p protocol Show only connections for the protocol specified;
may be either: TCP or UDP.
Windows 2K/XP also allow: TCPv6 or UDPv6.
If used with the -s option then the following protocols
may also be specified: IP, IPv6, ICMP,or ICMPv6.
-s Display per-protocol statistics. By default, statistics are
shown for IP, ICMP, TCP and UDP.
Windows 2K/XP will also display: IPv6, ICMPv6, TCPv6 and UDPv6
The -p option may be used to specify a subset of the default.
interval Redisplay statistics, pausing interval seconds between
each display. (default=once only) Press CTRL+C to stop.
-------------------------------------------------------------------------------------
Display Message with current Date and Time
Syntax NOW [message to be printed with time-stamp] Typical output:Mon Mar 06 14:58:48 2000 your message here
-------------------------------------------------------------------------------------------------
Trace route and provide network latency and packet loss for each router and link in the path.
Syntax
PATHPING [-n] [-h max_hops] [-g host_list] [-p period]
[-q num_queries] [-w timeout] [-t] [-R] [-r] target_name
Key
-n Don't resolve addresses to hostnames
-h max_hops Max number of hops to search, default=30
-g host_list Loose source route along host-list
up to 9 hosts in dotted decimal notation, separated by spaces.
-p period Wait between pings, default=250 (milliseconds)
-q num_queries Number of queries per hop, default=100
-w timeout Wait timeout for each reply, default is 3000 (milliseconds)
-T Test each hop with Layer-2 priority tags (QoS connectivity)
-R Test if each hop is Resource Reservation Protocol (RSVP) aware
All parameters are Case-Sensitive
Pathping is invaluable for determining which routers or subnets may be having network problems - it displays the degree of packet loss at any given router or link.
Pathping sends multiple Echo Request messages to each router between a source and destination over a period of time and computes aggregate results based on the packets returned from each router.
Pathping performs the equivalent of the tracert command by identifying which routers are on the path.
To avoid network congestion and to minimize the effect of burst losses, pings should be sent at a sufficiently slow pace (not too frequently.)
When -p is specified, pings are sent individually to each intermediate hop. When -w is specified, multiple pings can be sent in parallel. It's therefore possible to choose a Timeout parameter that is less than the wait Period * Number of hops.
Firewalls
Like tracert PathPing uses Internet Control Message Protocol (ICMP) over TCP/IP. Many firewalls will block ICMP traffic by default. If an attacker is able to forge ICMP redirect packets, he or she can alter the routing tables on the host and possibly subvert the security of the host by causing traffic to flow via a path you didn't intend.
"The path changes, so too must the traveler" - Tarek Verena
-------------------------------------------------------------------------------------------------
Syntax
PING [options] destination_host
Options
-w timeout Timeout in milliseconds to wait for each reply.
-i TTL Time To Live.
-v TOS Type Of Service.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-t Ping the destination host until interrupted.
-l size Send buffer size.
-f Set Don't Fragment flag in packet.
-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.
destination_host The name of the remote host
A response of "Request timed out" means there was no response to the ping attempt in the default time period of one second.
If the latency of the response is more than one second. Use the -w option on the ping command to increase the time-out. For example, to allow responses within five seconds, use ping -w 5000.
A successful PING does NOT always return an %errorlevel% == 0
Therefore to reliably detect a successful ping - pipe the output into FIND and look for the text "TTL"
Note that "Reply" in the output of PING does not always indicate a positive response. You may receive a message from a router such as: Reply from 192.168.1.254: Destination Net Unreachable.
Four steps to test an IP connection with ping:
1) Ping the loopback address to verify that TCP/IP is installed and configured correctly on the local computer.
PING 127.0.0.1
2) Ping the IP address of the local computer to verify that it was added to the network correctly.
PING IP_address_of_local_host
3) Ping the IP address of the default gateway to verify that the default gateway is functioning and that you can communicate with a local host on the local network.
PING IP_address_of_default_gateway
4) Ping the IP address of a remote host to verify that you can communicate through a router.
PING IP_address_of_remote_host
Examples
PING -n 1 -w 7500 Server_06
PING -w 7500 MyHost |find "TTL=" && ECHO MyHost found
PING -w 7500 MyHost |find "TTL=" || ECHO MyHost not found
PING -n 5 -w 7500 www.microsoft.com
PING -n 5 -w 7500 microsoft.com
PING stands for Packet InterNet Groper
Ping times below 10 milliseconds often have low accuracy.
A time of 10 milliseconds is roughly equal to a distance of 930 Miles, travelling a straight line route at the speed of light.
"And now I see with eye sereneThe very pulse of the machine."
- William Wordsworth, (She Was a Phantom of Delight)
-------------------------------------------------------------------------------------------------
Syntax
SHUTDOWN [logoff_option] [/m \\Computer] [options]
logoff_option:
/i Display the GUI (must be the first option)
/l Log off. This cannot be used with /m or /d option
/s Shutdown
/r Shutdown and Restart
/a Abort a system shutdown.
(only during the time-out period)
/p Turn off the local computer with no time-out or warning
(only with /d)
/h Hibernate the local computer (only with /f )
/e Document the reason for an unexpected shutdown of a computer
options:
/m \\Computer : A remote computer to shutdown.
/t:xxx : Time until system shutdown in seconds.
The valid range is xxx=0-600 seconds. [default=30]
/c "Msg" : An optional shutdown message [Max 127 chars]
/f : Force running applications to close.
This will not prompt for File-Save in any open applications.
so will result in a loss of all unsaved data!!!
/d u:xx:yy : List a USER reason code for the shutdown.
/d P:xx:yy : List a PLANNED reason code for the shutdown.
xx Specifies the major reason code (0-255)
yy Specifies the minor reason code (0-65536)
Example:
To create a desktop shortcut that will immediately shutdown your system - set the shortcut Target Properties to:
C:\Windows\System32\shutdown.exe -s
When using this command to reboot a server, the shutdown process will normally allow about 30 seconds to ensure each running service has time to stop. The shutdown can be made faster if all the services are first halted using NET STOP
Typical Reason codes:
E = Expected
U = Unexpected
P = planned (C = customer defined)
-------------------------------------------------------------------------------------
Syntax
SLEEP time
Key
time : the number of seconds to pause
For example:
To pause for an hour before running the next command in a batch file:
SLEEP 3600
An alternative if you have TCP/IP installed, is to use the PING command with
the loopback address of 127.0.0.1:
e.g. for a delay of 60 seconds:
PING -n 61 127.0.0.1>nul
"I think men talk to women so they can sleep with them and women sleep
with men so they can talk to them"
