Monthly Archives: May 2011

Popd

The popd command changes the current directory to the directory that was most recently stored by the pushd command. The pushd command saves the current working directory in memory so it can be returned to at any time.

Syntax (view syntax formatting guide):

popd

Syntax Explanation

  • /?: Displays help at the command prompt.

Every time you use the pushd command, a single directory is stored for your use. However, you can store multiple directories by using the pushd command multiple times.
The directories are stored sequentially in a virtual stack. If you use the pushd command once, the directory in which you use the command is placed at the bottom of the stack. If you use the command again, the second directory is placed on top of the first one. The process repeats every time you use the pushd command.
You can use the popd command to change the current directory to the directory most recently stored by the pushd command. If you use the popd command, the directory on the top of the stack is removed from the stack and the current directory is changed to that directory. If you use the popd command again, the next directory on the stack is removed.

When command extensions are enabled, the popd command removes any drive-letter assignations created by pushd.

Explanation with Examples

The following example shows how you can use the pushd command and the popd command to save and return to a current working directory:

C:usersTom>pushd /

C:>pobd

C:userTom>

 

Perfmon

The Perfmon command allows you to start the Windows Reliability and Performance Monitor in a specific standalone mode. Perfmon, also known as “Performance Monitor”, got its roots as a command called, “sysmon.exe” in Windows 95, 98 and XP. The perfmon command is used to view information about a systems; CPU, Disk, Network and Memory statistics.

Syntax (view syntax formatting guide):

perfmon </res|report|rel|sys>

Syntax Explanation

  • /res: Start Resource View.
  • /report: Start the System Diagnostics Data Collector Set and display a report of the results.
  • /rel: Start Reliability Monitor.
  • /sys: Start Performance Monitor.

Explanation with Examples

To view the performance monitor in a standalone view:

c:perfmon

To view the resource monitor in a standalone view:

c:perfmon /res

To view the reliability monitor built into Windows Vista and 7:

c:perfmon /rel

 

Pentnt

The Pentnt Command assists in the detection floating point division error (if present) in the Pentium chipset. When used with the –f option, pentnt enables forced emulation. When used with the –o options, pentnt disables forced emulation and turns on floating point hardware.

Syntax (view syntax formatting guide):

pentnt [-c] [-f] [-o]

Syntax Explanation

  • -c: Enables conditional emulation.
  • -f: Enables forced emulation.
  • -o: Disables forced emulation and re-enables floating-point hardware if it is present.
  • /?: Displays help at the command prompt.

Parameters used with this command must be prefixed with (hyphen) rather than / (slash).

Using the -c command-line option 

Floating-point emulation is forced on only if the system detects the Pentium processor floating-point division error at start time. If you select this parameter, you must restart the computer for the changes to take effect.

Using the -f command-line option Floating-point hardware is disabled and floating-point emulation is always forced on, regardless of whether the system exhibits the Pentium processor floating-point division error. This parameter is useful for testing software emulators and for working around floating-point hardware defects known to the operating system. If you select this parameter, you must restart the computer for the changes to take effect.

Using the -o command-line option If you select this parameter, you must restart the computer for the changes to take effect.

Explanation with Example

To enable floating-point emulation regardless of whether or not there is a floating-point division error:

pentnt –f

To disable forced emulation and re-enable floating-point hardware if it is present:

pentnt -o

 

Pause

The Pause command suspends the processing of a batch program and displays the following prompt:

Press any key to continue . . .

This is beneficial in case you do not wish to complete the batch program or perhaps you need to give the user a chance to insert a new disk into the drive before continuing the batch.

Syntax (view syntax formatting guide):

pause

Syntax Explanation

  • /?: Displays help at the command prompt.

When you run the pause command, the following message appears: 


Press any key to continue . . .

If you press CTRL+C to stop a batch program, the following message appears: 


Terminate batch job (Y/N)?


If you press Y (for yes) in response to this message, the batch program ends and control returns to the operating system.

You can insert the pause command before a section of the batch file that you might not want to process. When pause suspends processing of the batch program, you can press CTRL+C and then press Y to stop the batch program.

Explanation with Examples

To create a batch program that prompts the user to change disks in one of the drives:

@echo off
:Begin
copy a:*.*
echo Put a new disk into drive A
pause
goto begin

In this example, all the files on the disk in drive A are copied to the current directory. After the message prompts you to put a new disk in drive A, the pause command suspends processing so that you can change disks and then press any key to resume processing. This batch program runs in an endless loop—the goto begin command sends the command interpreter to the Begin label of the batch file. To stop this batch program, press CTRL+C and then press Y.

 

Pathping

The Pathping command lists information about network latency and network loss at intermediate hops between a source and destination. This is different from the tracert command which only identifies the number of hops/routers between a source and destination. Pathping sends multiple Echo Request messages to each router between a source and destination over a period of time and then computes results based on the packets returned from each router. Because pathping displays the degree of packet loss at any given router or link, you can determine which routers or subnets might be having network problems. Used without parameters, pathping displays help.

Syntax (view syntax formatting guide):

pathping [-n] [-h MaximumHops] [-g HostList] [-p Period] [-q NumQueries[-w Timeout] [-i IPAddress] [-4 IPv4] [-6 IPv6][TargetName]

Syntax Explanation

  • -n: Prevents pathping from attempting to resolve the IP addresses of intermediate routers to their names. This might expedite the display of pathping results.
  • -h MaximumHops: Specifies the maximum number of hops in the path to search for the target (destination). The default is 30 hops.
  • -g HostList: Specifies that the Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList. With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The HostList is a series of IP addresses (in dotted decimal notation) separated by spaces.
  • -p Period: Specifies the number of milliseconds to wait between consecutive pings. The default is 250 milliseconds (1/4 second).
  • -q NumQueries: Specifies the number of Echo Request messages sent to each router in the path. The default is 100 queries.
  • -w Timeout: Specifies the number of milliseconds to wait for each reply. The default is 3000 milliseconds (3 seconds).
  • -i IPAddress: Specifies the source address.
  • -4 IPv4: Specifies that pathping uses IPv4 only.
  • -6 IPv6: Specifies that pathping uses IPv6 only.
  • TargetName: Specifies the destination, which is identified either by IP address or host name.
  • /?: Displays help at the command prompt.

Pathping parameters are case-sensitive.

To avoid network congestion, pings should be sent at a sufficiently slow pace.

To minimize the effects of burst losses, do not send pings too frequently.

When using the -p parameter, pings are sent individually to each intermediate hop. Because of this, the interval between two pings sent to the same hop is period multiplied by the number of hops.

When using the -w parameter, multiple pings can be sent in parallel. Because of this, the amount of time specified in the Timeout parameter is not bounded by the amount of time specified in the Period parameter for waiting between pings.

This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Explanation with Examples

The following example shows pathping command output:

pathping -n corp1

D:>pathping -n corp1

Tracing route to corp1 [10.54.1.196]
over a maximum of 30 hops:
  0  172.16.87.35
  1  172.16.87.218
  2  192.168.52.1
  3  192.168.80.1
  4  10.54.247.14
  5  10.54.1.196

Computing statistics for 125 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           172.16.87.35
                                0/ 100 =  0%   |
  1   41ms     0/ 100 =  0%     0/ 100 =  0%  172.16.87.218
                               13/ 100 = 13%   |
  2   22ms    16/ 100 = 16%     3/ 100 =  3%  192.168.52.1
                                0/ 100 =  0%   |
  3   24ms    13/ 100 = 13%     0/ 100 =  0%  192.168.80.1
                                0/ 100 =  0%   |
  4   21ms    14/ 100 = 14%     1/ 100 =  1%  10.54.247.14
                                0/ 100 =  0%   |
  5   24ms    13/ 100 = 13%     0/ 100 =  0%  10.54.1.196

Trace complete.

When pathping is run, the first results list the path. This is the same path that is shown using the tracert command. Next, a busy message is displayed for approximately 90 seconds (the time varies by hop count). During this time, information is gathered from all routers previously listed and from the links between them. At the end of this period, the test results are displayed.

In the sample report above, the This Node/Link, Lost/Sent = Pct and Address columns show that the link between 172.16.87.218 and 192.168.52.1 is dropping 13 percent of the packets. The routers at hops 2 and 4 also are dropping packets addressed to them, but this loss does not affect their ability to forward traffic that is not addressed to them.

The loss rates displayed for the links, identified as a vertical bar (|) in the Address column, indicate link congestion that is causing the loss of packets that are being forwarded on the path. The loss rates displayed for routers (identified by their IP addresses) indicate that these routers might be overloaded.

 

Path

The Path command sets the command path in the PATH environment variable (the set of directories used to search for executable files). If used without parameters, path displays the current command path.

Syntax (view syntax formatting guide):

path [[<Drive>:]<Path>[;...][;%PATH%]]
path ;

Syntax Explanation

  • [Drive:]Path: Specifies the drive and directory to set in the command path.
  • [;]: Separates directories in the command path. If used without other parameters, ; clears the existing command paths from the PATH environment variable and directs Cmd.exe to search only in the current directory.
  • %PATH%: Appends the command path to the existing set of directories listed in the PATH environment variable.
  • [/?]: Displays help at the command prompt.

When you include %PATH% in the syntax, Cmd.exe replaces it with the command path values found in the PATH environment variable, eliminating the need to manually enter these values at the command prompt.

The current directory is always searched before the directories specified in the command path.

You might have files in a directory that share the same file name but have different extensions. For example, you might have a file named Accnt.com that starts an accounting program and another file named Accnt.bat that connects your server to the accounting system network. 
The Windows operating system searches for a file by using default file name extensions in the following order of precedence: .exe, .com, .bat, and .cmd. To run Accnt.bat when Accnt.com exists in the same directory, you must include the .bat extension at the command prompt.

If two or more files in the command path have the same file name and extension, path first searches for the specified file name in the current directory. Then it searches the directories in the command path in the order that they are listed in the PATH environment variable.

If you place the path command in your Autoexec.nt file, the Windows operating system automatically appends the specified MS-DOS subsystem search path every time you log on to your computer. Cmd.exe does not use the Autoexec.nt file.

When started from a shortcut, Cmd.exe inherits the environment variables set in My Computer/Properties/Advanced/Environment.

Explanation with Examples

To search the paths C:UserTaxes, B:UserInvest, and B:Bin for external commands:

path c:usertaxes;b:userinvest;b:bin

 

 

 

Ntbackup

The ntbackup command is a built-in backup utility that allows you to backup and restore full, differential and incremental backups of critical system files and data. Ntbackup was introduced in Windows NT in 1997 and is supported on Windows NT, 2000, XP and Windows 2003. Ntbackup is not available in Windows Vista or Windows Server 2008. Instead, you should use the wbadmin command and subcommands to back up and restore your computer and files from a command prompt.

It is important to note that you cannot recover backups that you created with ntbackup by using wbadmin. However, a version of ntbackup is available as a download for Windows Server 2008 and Windows Vista users who want to recover backups that they created using ntbackup. This downloadable version of ntbackup enables you to perform recoveries only of legacy backups, and it cannot be used on computers running Windows Server 2008 or Windows Vista to create new backups. To download this version of ntbackup, see http://go.microsoft.com/fwlink/?LinkId=82917.

 

NSLOOKUP Command Line

The Nslookup command line command allows you to displays information that you can use to diagnose Domain Name System (DNS) infrastructure. One thing you should note, before using this tool, you should be familiar with how DNS works. The Nslookup command prompt tool is available only if you have installed the TCP/IP protocol. Nslookup can be used directly from the command prompt or as a shell. If you run Nslookup with no parameters, it will enter shell mode, where you can type further commands as shown in the following image:

This image shows NSLOOKUP in interactive or shell mode. The shell mode commands are seen with the ? command.

The following syntax rules apply.

Syntax (view syntax formatting guide):

Nslookup [<-SubCommand ...>] [{<ComputerToFind> | -<Server>}]
Nslookup /exit
Nslookup /finger [<UserName>] [{[>] <FileName>|[>>] <FileName>}]
Nslookup /{help | ?}
Nslookup /ls [<Option>] <DNSDomain> [{[>] <FileName>|[>>] <FileName>}]
Nslookup /lserver <DNSDomain>
Nslookup /root
Nslookup /server <DNSDomain>
Nslookup /set <KeyWord>[=<Value>]
Nslookup /set all
Nslookup /set class=<Class>
Nslookup /set [no]d2
Nslookup /set [no]debug
Nslookup /set [no]defname
Nslookup /set domain=<DomainName>
Nslookup /set [no]ignore
Nslookup /set port=<Port>
Nslookup /set querytype=<ResourceRecordType>
Nslookup /set [no]recurse
Nslookup /set retry=<Number>
Nslookup /set root=<RootServer>
Nslookup /set [no]search
Nslookup /set srchlist=<DomainName>[/...]
Nslookup /set timeout=<Number>
Nslookup /set type=<ResourceRecordType>
Nslookup /set [no]vc
Nslookup /view <FileName>

Syntax Explanation

  • Nslookup /exit: Exits nslookup.
  • Nslookup /finger: Connects with the finger server on the current computer.
  • Nslookup /help: Displays a short summary of nslookup subcommands.
  • Nslookup /ls: Lists information for a DNS domain.
  • Nslookup /lserver: Changes the default server to the specified DNS domain.
  • Nslookup /root: Changes the default server to the server for the root of the DNS domain name space.
  • Nslookup /server: Changes the default server to the specified DNS domain.
  • Nslookup /set: Changes configuration settings that affect how lookups function.
  • Nslookup /set all: Prints the current values of the configuration settings.
  • Nslookup /set class: Changes the query class. The class specifies the protocol group of the information.
  • Nslookup /set d2: Turns exhaustive Debugging Mode on or off. All fields of every packet are printed.
  • Nslookup /set debug: Turns Debugging Mode on or off.
  • Nslookup /set defname: Appends the default DNS domain name to a single component lookup request. A single component is a component that contains no periods.
  • Nslookup /set domain: Changes the default DNS domain name to the name specified.
  • Nslookup /set ignore: Ignores packet truncation errors.
  • Nslookup /set port: Changes the default TCP/UDP DNS name server port to the value specified.
  • Nslookup /set querytype: Changes the resource record type for the query.
  • Nslookup /set recurse: Tells the DNS name server to query other servers if it does not have the information.
  • Nslookup /set retry: Sets the number of retries.
  • Nslookup /set root: Changes the name of the root server used for queries.
  • Nslookup /set search: Appends the DNS domain names in the DNS domain search list to the request until an answer is received. This applies when the set and the lookup request contain at least one period, but do not end with a trailing period.
  • Nslookup /set srchlist: Changes the default DNS domain name and search list.
  • Nslookup /set timeout: Changes the initial number of seconds to wait for a reply to a request.
  • Nslookup /set type: Changes the resource record type for the query.
  • Nslookup /set vc: Specifies to use or not use a virtual circuit when sending requests to the server.
  • Nslookup /view: Sorts and lists the output of the previous ls subcommand or commands.

Explanation with Examples

If ComputerToFind is an IP address and the query is for an A or PTR resource record type, the name of the computer is returned. If ComputerToFind is a name and does not have a trailing period, the default DNS domain name is appended to the name. This behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.

 

If you type a hyphen (-) instead of ComputerToFind, the command prompt changes to nslookup interactive mode.

 

The command-line length must be less than 256 characters.

Nslookup has two modes: interactive and noninteractive. 
If you need to look up only a single piece of data, use noninteractive mode. For the first parameter, type the name or IP address of the computer that you want to look up. For the second parameter, type the name or IP address of a DNS name server. If you omit the second argument, nslookup uses the default DNS name server.
If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. Or, omit both parameters and nslookup uses the default DNS name server. Following are some tips about working in interactive mode:

To interrupt interactive commands at any time, press CTRL+B.

To exit, type exit.

To treat a built-in command as a computer name, precede it with the escape character ().

An unrecognized command is interpreted as a computer name.

 

Examples

Each command-line option consists of a hyphen (-) followed immediately by the command name and, in some cases, an equal sign (=) and then a value.

To change the default query type to host (computer) information and the initial time-out to 10 seconds:

nslookup -querytype=hinfo -timeout=10

 

 

Nfsstat

The nfsstat command allow you to display the number of NFS calls made to the Server. When used with the –z option, the nfsstat command resets the number of NFS calls made to the Server to 0.

Syntax (view syntax formatting guide):

nfsstat [-z]

Syntax Explanation

  • Without [-z]: Displays the number of NFS V2, NFS V3, and Mount V3 calls made to the server since the counters were set to 0
  • [-z]: Resets the number of Mount V3 calls to 0

Explanation with Examples

To reset all call-related information to zero on the client and server, enter:

nfsstat –z

 

Nfsshare

The nfsshare command allow you to control Network File System (NFS) share. When you run the nfsshare command without arguments, the nfsshare command-line utility lists all Network File System (NFS) shares exported by Server for NFS. With ShareName as the only argument, nfsshare lists the properties of the NFS share identified by ShareName. When ShareName and Drive:Path are provided, nfsshare exports the folder identified by Drive:Path as ShareName. When the /delete option is used, the specified folder is no longer made available to NFS clients.

Syntax (view syntax formatting guide):

nfsshare <ShareName>=<Drive:Path> [-o <Option=value>...]
nfsshare {<ShareName> | <Drive>:<Path> | * } /delete

Syntax Explanation

The nfsshare command accepts the following options and arguments:

  • -o anon={yes | no}: Specifies whether anonymous (unmapped) users can access the shared directory. The default is no.
  • -o rw[=Host[:Host]…]: Provides read-write access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all hosts and client groups (except those specified with the ro option) have read-write access. If neither the ro nor the rw option is set, all clients have read-write access to the shared directory.
  • -o ro[=Host[:Host]…]: Provides read-only access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all clients (except those specified with the rw option) have read-only access. If the ro option is set for one or more clients, but the rw option is not set, only the clients specified with the ro option have access to the shared directory.
  • -o encoding={big5|euc-jp|euc-kr|euc-tw|gb2312-80|ksc5601|shift-jis}: Specifies the default encoding used for file and directory names and, if used, must be set to one of the following: big5 (Chinese);euc-jp (Japanese); euc-kr (Korean); euc-tw (Chinese); gb2312-80 (Simplified Chinese); ksc5601 (Korean); shift-jis (Japanese). If this is option is not set, the default encoding scheme is ANSI or, on systems configured for non-English locales, the default encoding scheme for the locale. The following are the default encoding schemes for the indicated locales: SHIFT-JIS (Japanese); KS_C_5601-1987 (Korean); GB2312-80 (Simplified Chinese); BIG5 (Traditional Chinese)
  • -o anongid=gid: Specifies that anonymous (unmapped) users will access the share directory using gid as their group identifier (GID). The default is -2. The anonymous GID will be used when reporting the owner of a file owned by an unmapped user, even if anonymous access is disabled.
  • -o anonuid=uid: Specifies that anonymous (unmapped) users will access the share directory using uid as their user identifier (UID). The default is -2. The anonymous UID will be used when reporting the owner of a file owned by an unmapped user, even if anonymous access is disabled.
  • -o root[=Host[:Host]…]: Provides root access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all clients have root access. If the root option is not set, no clients have root access to the shared directory.
  • /delete: If ShareName or Drive:Path is specified, deletes the specified share. If * is specified, deletes all NFS shares.

Explanation with Examples

Still to come!