MS Dos Tricks
Q. Why to learn 'MS DOS' when already GUI (Graphical User Interface) exist ?
My answer to those people is very simple that just use it once and very soon you will become edict of dos commands as they gives close interaction with Operating System. You become more independent of GUI and other OS restrictions.
Microsoft windows is changing day by day so the users who switches from one version of windows operating system to another, those people feels discomfort in using GUI interface after learning these few command you will be able to do any thing you want to do and which are not possible by GUI interface.
I've divided these dos commands on the basis of there uses and interaction levels.
How To Put the System into hibernation or Standby from Run menu:
To put the system in to hibernation:-
1] Make sure that the system is hibernation enabled. To confirm that, Click the Start button, go to Run menu and type in Powercfg.cpl and click OK. In the Power Options Propertiesclick Hibernate tab and make sure that Enable hibernation option is checked. Click OK/Apply.
2] Now Click the Start button, go to Run menu and type in %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState and click OK.
To put the system in to Stand by :-
1]Make sure that the system is hibernation disabled. To confirm that, Click the Start button, go to Run menu and type in Powercfg.cpl and click OK. In the Power Options Propertiesclick Hibernate tab and make sure that Enable hibernation option is unchecked. Click OK/Apply.
2]Now Click the Start button, go to Run menu and type in %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState and click OK. link to Microsoft website
Command-Line Programs for Intranets and the Internet
1. netstat [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [interval]
Description:
Displays protocol statistics and current TCP/IP network connections.
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection
listening port. In some cases well-known executable host
multiple independent components, and in these cases the
sequence of components involved in creating the connection
or listening port is displayed. In this case the executable
name is in [] at the bottom, on top is the component it ca
and so forth until TCP/IP was reached. Note that this option
can be time-consuming and will fail unless you have suffices
permissions.
-e Displays Ethernet statistics. This may be combined with the
option.
-f Displays Fully Qualified Domain Names (FQDN) for foreign
addresses.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection
-p Shows connections for the protocol specified by proto; pro
may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the
option to display per-protocol statistics, proto may be an
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDP
the -p option may be used to specify a subset of the default
-t Displays the current connection offload state.
redisplay selected statistics, pausing interval seconds
between each display. Press CTRL+C to stop re-displaying
statistics. If omitted, netstat will print the current
configuration information once.
2. ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name
Options:
-t Ping 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 (IPv4-only).
-i TTL Time To Live.
-v TOS Type Of Service (IPv4-only).
-r count Record route for count hops (IPv4-only).
-s count Timestamp for count hops (IPv4-only).
-j host-lis Loose source route along host-list (IPv4-only).
-k host-list Strict source route along host-list (IPv4-only).
-w timeout Timeout in milliseconds to wait for each reply.
-R Use routing header to test reverse route also (IPv6-onl
-S srcaddr Source address to use (IPv6-only).
-4 Force using IPv4.
-6 Force using IPv6.
[Note: There's one special IP number everyone should know about:
127.0.0.1 - local-host (or loop-back).
This is used to connect ( through a browser, for example) to a Web server
on your own computer. (127 being reserved for this purpose.) You can use
this IP number at all times. It doesn't matter if you're connected to the
Internet or not. It's also called the loop-back address because you can ping
it and get returns even when you're offline (not connected to any network).
If you don't get any valid replies, then there's a problem with the computer's
Network settings. Here's a typical response to the 'ping' command]
3. tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout]
[-R] [-S srcaddr] [-4] [-6] target_name
Options:
-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 (IPv4-only).
-w timeout Wait timeout milliseconds for each reply.
-R Trace round-trip path (IPv6-only).
-S srcaddr Source address to use (IPv6-only).
-4 Force using IPv4.
-6 Force using IPv6.
[Note: Here's an example which traces the route from some ISP in Los Angeles to
the main server at UCLA in California ( note how two computers relatively
close to each other may be routed way round about! ]
4. nbtstat [ [-a RemoteName] [-A IP address] [-c] [-n]
[-r] [-R] [-RR] [-s] [-S] [interval] ]
Displays protocol statistics and current TCP/IP connections using NBT
(NetBIOS over TCP/IP).
-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 NBT's cache of remote [machine] names and their
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 computer NETBIOS names.
-RR (ReleaseRefresh) Sends Name Release packets to WINS and then,
starts Refresh
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.
5. route [-f] [-p] [-4|-6] command [destination]
[MASK netmask] [gateway] [METRIC metric] [IF interface]
Description:
Manipulates network routing tables.
-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.
-4 Force using IPv4.
-6 Force using IPv6.
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*.
6. arp -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr] [-v]
Description:
Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).
-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.
-v Displays current ARP entries in verbose mode. All invalid
entries and entries on the loop-back interface will be shown.
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. inet_addr may be
wildcarded with * to delete all hosts.
-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 separated 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.
Example:
> arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.
> arp -a .... Displays the arp table.
External Commands:
1. ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]]
Description:
Displays or changes file attributes.
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
I Not content indexed file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Link
Trick:
This command is used for setting properties of a folder or file to Hidden, Read Only, System and Archive. So you can select a file/folder as system folder which will not be visible when you select "Show hidden files and folders" inside Tools > Folder Option > View
2. CHOICE [/C choices] [/N] [/CS] [/T timeout /D choice] [/M text]
Description:
This tool allows users to select one item from a list
of choices and returns the index of the selected choice.
Parameter List:
/C choices Specifies the list of choices to be created.
Default list is "YN".
/N Hides the list of choices in the prompt.
The message before the prompt is displayed
and the choices are still enabled.
/CS Enables case-sensitive choices to be selected.
By default, the utility is case-insensitive.
/T timeout The number of seconds to pause before a default
choice is made. Acceptable values are from 0 to
9999. If 0 is specified, there will be no pause
and the default choice is selected.
/D choice Specifies the default choice after nnnn seconds.
Character must be in the set of choices specified
by /C option and must also specify nnnn with /T.
/M text Specifies the message to be displayed before
the prompt. If not specified, the utility
displays only a prompt.
/? Displays this help message.
NOTE:
The ERRORLEVEL environment variable is set to the index of the
key that was selected from the set of choices. The first choice
listed returns a value of 1, the second a value of 2, and so on.
If the user presses a key that is not a valid choice, the tool
sounds a warning beep. If tool detects an error condition,
it returns an ERRORLEVEL value of 255. If the user presses
CTRL+BREAK or CTRL+C, the tool returns an ERRORLEVEL value
of 0. When you use ERRORLEVEL parameters in a batch program, list
them in decreasing order.
Examples:
CHOICE /?
CHOICE /C YNC /M "Press Y for Yes, N for No or C for Cancel."
CHOICE /T 10 /C ync /CS /D y
CHOICE /C ab /M "Select a for option 1 and b for option 2."
CHOICE /C ab /N /M "Select a for option 1 and b for option 2."