15
Commonly-Used Commands Attrib Displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories. Used without parameters, attrib displays attributes of all files in the current directory. Syntax attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[Drive:][Path] FileName] [/s[/d]] Top of page Parameters +r : Sets the read-only file attribute. -r : Clears the read-only file attribute. +a : Sets the archive file attribute. -a : Clears the archive file attribute. +s : Sets the system file attribute. -s : Clears the system file attribute. +h : Sets the hidden file attribute. -h : Clears the hidden file attribute. [Drive:][Path] FileName : Specifies the location and name of the directory, file, or set of files for which you want to display or change attributes. You can use wildcard characters (that is, ? and *) in the FileName parameter to display or change the attributes for a group of files. /s : Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. /d : Applies attrib and any command-line options to directories. Cacls Displays or modifies discretionary access control list (DACL) files. Syntax cacls FileName [/t] [/e] [/c] [/g User:permission] [/r User [...]] [/p User:permission [...]] [/d User [...]] Top of page Parameters FileName : Required. Displays DACLs of specified files. /t : Changes DACLs of specified files in the current directory and all subdirectories. /e : Edits a DACL instead of replacing it. /c : Continues to change DACLs, ignoring errors. /g User:permission : Grants access rights to the specified user. The following table lists valid values for permission. Value Description n None r Read w Write c Change (Write) f Full Control /r User : Revokes access rights for the specified user. /p User:permission : Replaces access rights for the specified user. The following table lists valid values for permission. Value Description n None r Read w Write c Change (Write)

Commands

Embed Size (px)

DESCRIPTION

Common Command in WIndows

Citation preview

  • Commonly-Used Commands

    Attrib Displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories. Used without parameters, attrib displays attributes of all files in the current directory.

    Syntax attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[Drive:][Path] FileName] [/s[/d]]

    Top of page Parameters +r : Sets the read-only file attribute. -r : Clears the read-only file attribute. +a : Sets the archive file attribute. -a : Clears the archive file attribute. +s : Sets the system file attribute. -s : Clears the system file attribute. +h : Sets the hidden file attribute. -h : Clears the hidden file attribute. [Drive:][Path] FileName : Specifies the location and name of the directory, file, or set of files for which you want to display or change attributes. You can use wildcard characters (that is, ? and *) in the FileName parameter to display or change the attributes for a group of files. /s : Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. /d : Applies attrib and any command-line options to directories.

    Cacls Displays or modifies discretionary access control list (DACL) files.

    Syntax cacls FileName [/t] [/e] [/c] [/g User:permission] [/r User [...]] [/p User:permission [...]] [/d User [...]]

    Top of page

    Parameters FileName : Required. Displays DACLs of specified files. /t : Changes DACLs of specified files in the current directory and all subdirectories. /e : Edits a DACL instead of replacing it. /c : Continues to change DACLs, ignoring errors. /g User:permission : Grants access rights to the specified user. The following table lists valid values for permission.

    Value Description

    n None

    r Read

    w Write

    c Change (Write)

    f Full Control

    /r User : Revokes access rights for the specified user. /p User:permission : Replaces access rights for the specified user. The following table lists valid values for permission.

    Value Description

    n None

    r Read

    w Write

    c Change (Write)

  • Value Description

    f Full Control

    /d User : Denies access for the specified user.

    Chdir (Cd) Displays the name of the current directory or changes the current folder. Used with only a drive letter (for example, chdir C:), chdir displays the names of the current drive and folder. Used without parameters, chdir displays the current drive and directory.

    Syntax chdir [[/d] [Drive:][Path] [..]] [[/d] [Drive:][Path] [..]] cd [[/d] [Drive:][Path] [..]] [[/d] [Drive:][Path] [..]]

    Top of page Parameters /d : Changes the current drive or the current directory for a drive. [drive:][Path] : Specifies the drive (that is, if it is different from the current drive) and directory to which you want to change. [..] : Specifies that you want to change to the parent folder.

    Chkdsk Creates and displays a status report for a disk based on the file system. Chkdsk also lists and corrects errors on the disk. Used without parameters, chkdsk displays the status of the disk in the current drive.

    Syntax chkdsk [volume:][[Path] FileName] [/f] [/v] [/r] [/x] [/i] [/c] [/l[:size]]

    Top of page Parameters volume: : Specifies the drive letter (followed by a colon), mount point, or volume name. [Path] FileName : Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use wildcard characters (that is, * and ?) to specify multiple files. /f : Fixes errors on the disk. The disk must be locked. If chkdsk cannot lock the drive, a message appears that asks you if you want to check the drive the next time you restart the computer. /v : Displays the name of each file in every directory as the disk is checked. /r : Locates bad sectors and recovers readable information. The disk must be locked. /x : Use with NTFS only. Forces the volume to dismount first, if necessary. All open handles to the drive are invalidated. /x also includes the functionality of /f. /i : Use with NTFS only. Performs a less vigorous check of index entries, reducing the amount of time needed to run chkdsk. /c : Use with NTFS only. Skips the checking of cycles within the folder structure, reducing the amount of time needed to run chkdsk. /l[:size] : Use with NTFS only. Changes the log file size to the size you type. If you omit the size parameter, /l displays the current size.

    Chkntfs Displays or specifies whether automatic system checking is scheduled to be run on a FAT, FAT32, or NTFS volume when the computer is started.

    Syntax chkntfs volume: [...] chkntfs [/d] chkntfs [/t[:time]] chkntfs [/x volume: [...]] chkntfs [/c volume: [...]]

    Top of page

  • Parameters volume: [...] : Required. Specifies the drive letter (followed by a colon), mount point, or volume name. Displays a message that identifies the file system of the specified volume. If automatic file checking is scheduled to be run, this parameter displays a message indicating whether the volume has been corrupted, which requires you to run chkdsk. /d : Restores all chkntfs default settings, except the countdown time for automatic file checking. Default behavior is to check all volumes when the computer is started. /t[:time] : Changes the Autochk.exe initiation countdown time to the specified amount of time entered in seconds. If you do not specify :time, /t displays the current countdown time. /x volume: [...] : Excludes the specified volume from being checked when the computer starts, even if the volume is marked as requiring chkdsk. /c volume: [...] : Schedules the specified volume to be checked when the computer starts.

    Copy Copies one or more files from one location to another.

    Syntax copy [/d] [/v] [/n] [{/y|/-y}] [/z] [{/a|/b}] Source [{/a|/b}] [+ Source [{/a|/b}] [+ ...]]

    [Destination [{/a|/b}]] Top of page

    Parameters /d : Allows the encrypted files being copied to be saved as decrypted files at the destination.

    /v : Verifies that new files are written correctly. /n : Uses a short file name, if available, when copying a file with a name longer than eight characters, or with a file extension longer than three characters. /y : Suppresses prompting to confirm that you want to overwrite an existing destination file. /-y : Prompts you to confirm that you want to overwrite an existing destination file. /z : Copies networked files in restartable mode. /a : Indicates an ASCII text file. /b : Indicates a binary file. Source : Required. Specifies the location from which you want to copy a file or set of files. Source can consist of a drive letter and colon, a folder name, a file name, or a combination of these. Destination : Required. Specifies the location to which you want to copy a file or set of files. Destination can consist of a drive letter and colon, a folder name, a file name, or a combination of these.

    Defrag Locates and consolidates fragmented boot files, data files, and folders on local volumes.

    Syntax defrag volume defrag volume [/a] defrag volume [/a] [/v] defrag volume [/v] defrag volume [/f]

    Top of page Parameters volume : The drive letter or a mount point of the volume to be defragmented. /a : Analyzes the volume and displays a summary of the analysis report. /v : Displays the complete analysis and defragmentation reports. When used in combination with /a, displays only the analysis report. When used alone, displays both the analysis and defragmentation reports. /f : Forces defragmentation of the volume regardless of whether it needs to be defragmented.

    Del (erase) Deletes specified files.

    Syntax del [Drive:][Path] FileName [ ...] [/p] [/f] [/s] [/q] [/a[:attributes]]

  • erase [Drive:][Path] FileName [ ...] [/p] [/f] [/s] [/q] [/a[:attributes]] Top of page

    Parameters [Drive:][Path] FileName : Specifies the location and name of the file or set of files you want to delete. Filename is required. You can use multiple file names. Separate file names with spaces, commas, or semicolons. /p : Prompts you for confirmation before deleting the specified file. /f : Forces deletion of read-only files. /s : Deletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted. /q : Specifies quiet mode. You are not prompted for delete confirmation. /a : Deletes files based on specified attributes. attributes : Specifies any of the following file attributes:

    Attribute Description

    r Read-only

    a Archive

    s System

    h Hidden

    - Prefix meaning "not"

    Dir Displays a list of a directory's files and subdirectories. Used without parameters, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk, including their names and the date and time each was last modified. For files, dir displays the name extension and the size in bytes. Dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.

    Syntax dir [Drive:][Path][FileName] [...] [/p] [/q] [/w] [/d] [/a[[:]attributes]][/o[[:]SortOrder]] [/t[[:]TimeField]] [/s] [/b] [/l] [/n] [/x] [/c] [/4]

    Top of page Parameters [Drive:][Path] : Specifies the drive and directory for which you want to see a listing. [FileName] : Specifies a particular file or group of files for which you want to see a listing. /p : Displays one screen of the listing at a time. To see the next screen, press any key on the keyboard. /q : Displays file ownership information. /w : Displays the listing in wide format, with as many as five file names or directory names on each line. /d : Same as /w but files are sorted by column. /a [[:] attributes] : Displays only the names of those directories and files with the attributes you specify. If you omit /a, dir displays the names of all files except hidden and system files. If you use /a without specifying attributes, dirdisplays the names of all files, including hidden and system files. The following list describes each of the values you can use for attributes. The colon (:) is optional. Use any combination of these values, and do not separate the values with spaces.

    Value Description

    h Hidden files

    s System files

    d Directories

    a Files ready for archiving

    r Read-only files

    -h Files that are not hidden

    -s Files other than system files

    -d Files only (not directories)

    -a Files that have not changed since the last backup

  • Value Description

    -r Files that are not read-only

    /o [[:]SortOrder] : Controls the order in which dir sorts and displays directory names and file names. If you omit /o, dir displays the names in the order in which they occur in the directory. If you use /o without specifying SortOrder, dirdisplays the names of the directories, sorted in alphabetic order, and then displays the names of files, sorted in alphabetic order. The colon (:) is optional. The following list describes each of the values you can use for SortOrder. Use any combination of the values, and do not separate these values with white spaces.

    Value Description

    n In alphabetic order by name

    e In alphabetic order by extension

    d By date and time, earliest first

    s By size, smallest first

    g With directories grouped before files

    -n In reverse alphabetic order by name (Z through A)

    -e In reverse alphabetic order by extension (.ZZZ through .AAA)

    -d By date and time, latest first

    -s By size, largest first

    -g With directories grouped after files

    /t [[:]TimeField] : Specifies which time field to display or use for sorting. The following list describes each of the values you can use for TimeField.

    Value Description

    c Creation

    a Last access

    w Last written

    /s : Lists every occurrence, in the specified directory and all subdirectories, of the specified file name. /b : Lists each directory name or file name, one per line, including the file name extension. /b does not display heading information or a summary. /b overrides /w. /l : Displays unsorted directory names and file names in lowercase. /l does not convert extended characters to lowercase. /n : Displays a long list format with file names on the far right of the screen. /x : Displays the short names generated for files on NTFS and FAT volumes. The display is the same as the display for /n, but short names are displayed after the long name. /c : Displays the thousand separator in file sizes. /4 : Displays four-digit year format.

    Format Formats the disk in the specified volume to accept Windows files.

    Syntax format volume [/fs:file-system] [/v:label] [/q] [/a:UnitSize] [/c] [/x] format volume [/v:label] [/q] [/f:size] format volume [/v:label] [/q] [/t:tracks /n:sectors] format volume [/v:label] [/q] format volume [/q]

    Top of page Parameters volume : Specifies the mount point, volume name, or drive letter of the drive you want to format. If you do not specify any of the following command-line options, format uses the volume type to determine the default format for the disk. /fs:file-system : Specifies the file system to use FAT, FAT32, or NTFS Floppy disks can use only the FAT file system. /v:label : Specifies the volume label. If you omit the /v command-line option or use it without specifying a volume label, format prompts you for the volume label after the formatting is completed. Use the syntax /v: to

  • prevent the prompt for a volume label. If you format more than one disk by using one format command, all of the disks will be given the same volume label. For more information about disk volume labels, click Dir, Label, and Vol in the Related Topics list. /a:UnitSize : Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. If you do not specify UnitSize, it is chosen based on volume size. The following table lists valid values for UnitSize.

    Value Description

    512 Creates 512 bytes per cluster.

    1024 Creates 1024 bytes per cluster.

    2048 Creates 2048 bytes per cluster.

    4096 Creates 4096 bytes per cluster.

    8192 Creates 8192 bytes per cluster.

    16K Creates 16 kilobytes per cluster.

    32K Creates 32 kilobytes per cluster.

    64K Creates 64 kilobytes per cluster.

    /q : Performs a quick format. Deletes the file table and the root directory of a previously formatted volume but does not perform a sector by sector scan for bad areas. You should use the /q command-line option to format only previously formatted volumes that you know are in good condition. /f:size : Specifies the size of the floppy disk to format. When possible, use this command-line option instead of the /t and /n command-line options. Windows accepts the following value for size: 1440 or 1440k or 1440kb or 1.44 or 1.44m or 1.44mb 1.44-MB, double-sided, quadruple-density, 3.5-inch disk /t:tracks : Specifies the number of tracks on the disk. When possible, use the /f command-line option instead of this command-line option. If you use the /t command-line option, you must also use the /n command-line option. These two command-line options provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f command-line option with the /t command-line option. /n:sectors : Specifies the number of sectors per track. When possible, use the /f command-line option instead of this command-line option. If you use the /n command-line option, you must also use the /t command-line option. These two command-line options provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f command-line option with the /n command-line option. /c : NTFS only. Files created on the new volume will be compressed by default. /x : Causes the volume to dismount, if necessary, before it is formatted. Any open handles to the volume will no

    longer be valid. /? : Displays help at the command prompt.

    Top of page Remarks

    Using format at the Recovery Console The format command, with different parameters, is available from the Recovery Console.

    Administrative privileges You must be a member of the Administrators group to format a hard drive.

    Using format The format command creates a new root directory and file system for the disk. It can also check for bad areas on the disk, and it can delete all data on the disk. To be able to use a new disk, you must first use this command to format the disk.

    Typing a volume label After formatting a floppy disk, format displays the following message: Volume label (11 characters, ENTER for none)? The volume label can be a maximum of 11 characters (including spaces). If you do not want your disk to have a volume label, just press ENTER. For information about volume labels, click label in the Related Topics list.

    Formatting a hard disk When you use the format command to format a hard disk, format displays a message of the following form before attempting to format the hard disk: WARNING, ALL DATA ON nonremovable DISK

    DRIVE x: WILL BE LOST!

    Proceed with Format (Y/N)?_

    To format the hard disk, press Y; if you do not want to format the disk, press N. You must have Administrator rights to format a hard disk.

    Unit size

  • FAT file systems restrict the number of clusters to no more than 65526. FAT32 file systems restrict the number of clusters to between 65527 and 4177917. NTFS compression is not supported for allocation unit sizes above 4096.

    Format messages When formatting is complete, format displays messages showing the total disk space, any space marked as defective, and the space available for your files.

    Quick formatting You can speed up the formatting process by using the /q command-line option. Use this command-line option only if there are no bad sectors on your hard disk.

    Using format with a reassigned drive or a network drive You should not use the format command on a drive prepared by using the subst command. You cannot format disks over a network.

    Format exit codes The following table lists each exit code and a brief description of its meaning.

    Exit code Description

    0 The format operation was successful.

    1 Incorrect parameters were supplied.

    4 A fatal error occurred (any error other than 0, 1, or 5).

    5 The user pressed N in response to the prompt "Proceed with Format (Y/N)?" to stop the process.

    You can check these exit codes by using the errorlevel condition with the if batch command. Top of page

    Examples To format a new floppy disk in drive A using the default size, type: format a: To perform a quick format operation on a previously formatted disk in drive A, type: format a: /q To format a floppy disk in drive A and assign it the volume label "DATA," type: format a: /v:DATA

    Top of page Formatting legend

    Format Meaning

    Italic Information that the user must supply

    Bold Elements that the user must type exactly as shown

    Ellipsis (...) Parameter that can be repeated several times in a command line

    Between brackets ([]) Optional items

    Between braces ({}); choices separated by pipe (|). Example: {even|odd}

    Set of choices from which the user must choose only one

    Courier font Code or program output

    Ipconfig Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays the IP address, subnet mask, and default gateway for all adapters.

    Syntax ipconfig [/all] [/renew [Adapter]] [/release [Adapter]] [/flushdns] [/displaydns] [/registerdns] [/showclassid Adapter] [/setclassid Adapter [ClassID]]

    Top of page Parameters /all : Displays the full TCP/IP configuration for all adapters. Without this parameter, ipconfig displays only the IP address, subnet mask, and default gateway values for each adapter. Adapters can represent physical interfaces, such as installed network adapters, or logical interfaces, such as dial-up connections. /renew [Adapter] : Renews DHCP configuration for all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter is available only on computers with adapters that are

  • configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. /release [Adapter] : Sends a DHCPRELEASE message to the DHCP server to release the current DHCP configuration and discard the IP address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if theAdapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. /flushdns : Flushes and resets the contents of the DNS client resolver cache. During DNS troubleshooting, you can use this procedure to discard negative cache entries from the cache, as well as any other entries that have been added dynamically. /displaydns : Displays the contents of the DNS client resolver cache, which includes both entries preloaded from the local Hosts file and any recently obtained resource records for name queries resolved by the computer. The DNS Client service uses this information to resolve frequently queried names quickly, before querying its configured DNS servers. /registerdns : Initiates manual dynamic registration for the DNS names and IP addresses that are configured at a computer. You can use this parameter to troubleshoot a failed DNS name registration or resolve a dynamic update problem between a client and the DNS server without rebooting the client computer. The DNS settings in the advanced properties of the TCP/IP protocol determine which names are registered in DNS. /showclassid Adapter : Displays the DHCP class ID for a specified adapter. To see the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. /setclassid Adapter [ClassID] : Configures the DHCP class ID for a specified adapter. To set the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on

    computers with adapters that are configured to obtain an IP address automatically. If a DHCP class ID is not specified, the current class ID is removed.

    Mkdir (md) Creates a directory or subdirectory.

    Syntax mkdir [Drive:]Path md [Drive:]Path

    Top of page Parameters Drive: : Specifies the drive on which you want to create the new directory. Path : Required. Specifies the name and location of the new directory. The maximum length of any single path is determined by the file system.

    Move Moves one or more files from one directory to the specified directory.

    Syntax move [{/y|/-y}] [Source] [target]

    Top of page Parameters /y : Suppresses prompting to confirm you want to overwrite an existing destination file. /-y : Causes prompting to confirm you want to overwrite an existing destination file. Source : Specifies the path and name of the file or files to move. If you want to move or rename a directory, Source should be the current directory path and name. target : Specifies the path and name to move files to. If you want to move or rename a directory, target should be the desired directory path and name.

    Msinfo32 Displays a comprehensive view of your hardware, system components, and software environment.

    Syntax msinfo32 [/?] [/pch] [/nfo FileName] [/report FileName] [/computer ComputerName] [/showcategories] [/category categoryID] [/categories categoryID]

  • Top of page Parameters FileName : Specifies the file to be opened. This can be an .nfo, .xml, .txt, or .cab file. /? : Displays help for the msinfo32 command. /pch : Displays the history view. /nfo FileName : Saves the exported file as an .nfo file. /report FileName : Saves the exported file as a .txt file. /computer ComputerName : Starts System Information for the specified remote computer. /showcategories : Starts System Information with all available category IDs displayed. /category categoryID : Starts System Information with the specified category selected. Use /showcategories to display a list of available category IDs. /categories categoryID : Starts System Information with only the specified category or categories displayed. It also limits the output to the selected category or categories. Use /showcategories to display a list of available category IDs.

    Net use Connects a computer to or disconnects a computer from a shared resource, or displays information about computer

    connections. The command also controls persistent net connections. Used without parameters, net use retrieves a

    list of network connections.

    Syntax net use [{DeviceName | *}] [\\ComputerName\ShareName[\volume]] [{Password | *}]]

    [/user:[DomainName\]UserName] [/user:[DottedDomainName\]UserName]

    [/user: [UserName@DottedDomainName] [/savecred] [/smartcard] [{/delete | /persistent:{yes | no}}]

    net use [DeviceName [/home[{Password | *}] [/delete:{yes | no}]]

    net use [/persistent:{yes | no}] Top of page

    Parameters DeviceName : Assigns a name to connect to the resource or specifies the device to be disconnected. There are

    two kinds of device names: disk drives (that is, D: through Z:) and printers (that is, LPT1: through LPT3:). Type an

    asterisk (*) instead of a specific device name to assign the next available device name.

    \\ComputerName\ShareName : Specifies the name of the server and the shared resource.

    If ComputerName contains spaces, use quotation marks around the entire computer name from the double

    backslash (\\) to the end of the computer name (for example, "\\Computer Name\Share Name"). The computer

    name can be from 1 to 15 characters long.

    \volume : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and

    running to connect to NetWare servers.

    Password : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a

    prompt for the password. The password is not displayed when you type it at the password prompt.

    /user : Specifies a different user name with which the connection is made.

    DomainName : Specifies another domain. If you omit DomainName, net use uses the current logged on domain.

    UserName : Specifies the user name with which to log on.

    DottedDomainName : Specifies the fully-qualified domain name for the domain where the user account exists.

    /savecred : Stores the provided credentials for reuse.

    /smartcard : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards

    are available, you are asked to specify the credential.

    /delete : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network

    connections are canceled.

    /persistent:{yes | no} : Controls the use of persistent network connections. The default is the setting used last.

    Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next

    logon. Nodoes not save the connection being made or subsequent connections. Existing connections are restored

    at the next logon. Use /delete to remove persistent connections.

    /home : Connects a user to the home directory.

  • Netstat Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Used without parameters, netstat displays active TCP connections.

    Syntax netstat [-a] [-e] [-n] [-o] [-p Protocol] [-r] [-s] [Interval]

    Top of page

    Parameters -a : Displays all active TCP connections and the TCP and UDP ports on which the computer is listening. -e : Displays Ethernet statistics, such as the number of bytes and packets sent and received. This parameter can be combined with -s. -n : Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names. -o : Displays active TCP connections and includes the process ID (PID) for each connection. You can find the application based on the PID on the Processes tab in Windows Task Manager. This parameter can be combined with -a, -n, and -p. -p Protocol : Shows connections for the protocol specified by Protocol. In this case, the Protocol can

    be tcp, udp, tcpv6, or udpv6. If this parameter is used with -s to display statistics by protocol, Protocol can be tcp, udp, icmp, ip, tcpv6,udpv6, icmpv6, or ipv6. -s : Displays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols. If the IPv6 protocol for Windows XP is installed, statistics are shown for the TCP over IPv6, UDP over IPv6, ICMPv6, and IPv6 protocols. The -p parameter can be used to specify a set of protocols. -r : Displays the contents of the IP routing table. This is equivalent to the route print command. Interval : Redisplays the selected information every Interval seconds. Press CTRL+C to stop the redisplay. If this parameter is omitted, netstat prints the selected information only once.

    Nslookup Displays information that you can use to diagnose Domain Name System (DNS) infrastructure. Before using this tool, you should be familiar with how DNS works. The Nslookup command-line tool is available only if you have installed the TCP/IP protocol.

    Syntax nslookup [-SubCommand ...] [{ComputerToFind| [-Server]}]

    Top of page

    Parameters -SubCommand ... : Specifies one or more nslookup subcommands as a command-line option. For a list of subcommands, see Related Topics. ComputerToFind : Looks up information for ComputerToFind using the current default DNS name server, if no other server is specified. To look up a computer not in the current DNS domain, append a period to the name. -Server : Specifies to use this server as the DNS name server. If you omit -Server, the default DNS name server is used.

    Pathping Provides information about network latency and network loss at intermediate hops 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. Pathpingperforms the equivalent of the tracert command by identifying which routers are on the path. It then sends pings periodically to all of the routers over a specified time period and computes statistics based on the number returned from each. Used without parameters, pathping displays help.

    Syntax pathping [-n] [-h MaximumHops] [-g HostList] [-p Period] [-q NumQueries [-w Timeout] [-T] [-R] [TargetName]

    Top of page Parameters

  • -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). -T : Attaches a layer-2 priority tag (for example, 802.1p) to the Echo Request messages that it sends to each of the network devices along the route. This helps to identify network devices that do not have layer-2 priority capability. This switch is used to test for Quality of Service (QoS) connectivity. -R : Determines whether each network device along the route supports the Resource Reservation Protocol (RSVP), which allows the host computer to reserve a specified amount of bandwidth for a data stream. This switch is used to test for Quality of Service (QoS) connectivity. TargetName : Specifies the destination, which is identified either by IP address or host name.

    Perfmon Allows you to open a Windows XP Performance console configured with settings files from Windows NT 4.0 version of Performance Monitor.

    Syntax perfmon.exe [file_name] [/HTMLFILE:converted_file settings_file]

    Top of page Parameters .exe : Specifies the name of the file extension. file_name : Specifies the name of the settings file. /HTMLFILE:converted_file settings_file : Specifies the name of the converted files, and the name of the

    original Windows NT 4.0 settings file.

    Ping Verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) Echo Request messages. The receipt of corresponding Echo Reply messages are displayed, along with round-trip times. Ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution. Used without parameters, ping displays help.

    Syntax ping [-t] [-a] [-n Count] [-l Size] [-f] [-i TTL] [-v TOS] [-r Count] [-s Count] [{-j HostList | -k HostList}] [-w Timeout] [TargetName]

    Top of page Parameters -t : Specifies that ping continue sending Echo Request messages to the destination until interrupted. To interrupt and display statistics, press CTRL-BREAK. To interrupt and quit ping, press CTRL-C. -a : Specifies that reverse name resolution is performed on the destination IP address. If this is successful, ping displays the corresponding host name. -n Count : Specifies the number of Echo Request messages sent. The default is 4. -l Size : Specifies the length, in bytes, of the Data field in the Echo Request messages sent. The default is 32. The maximum size is 65,527. -f : Specifies that Echo Request messages are sent with the Don't Fragment flag in the IP header set to 1. The Echo Request message cannot be fragmented by routers in the path to the destination. This parameter is useful for troubleshooting path Maximum Transmission Unit (PMTU) problems. -i TTL : Specifies the value of the TTL field in the IP header for Echo Request messages sent. The default is the default TTL value for the host. For Windows XP hosts, this is typically 128. The maximum TTL is 255. -v TOS : Specifies the value of the Type of Service (TOS) field in the IP header for Echo Request messages sent. The default is 0. TOS is specified as a decimal value from 0 to 255.

  • -r Count : Specifies that the Record Route option in the IP header is used to record the path taken by the Echo Request message and corresponding Echo Reply message. Each hop in the path uses an entry in the Record Route option. If possible, specify a Count that is equal to or greater than the number of hops between the source and destination. The Count must be a minimum of 1 and a maximum of 9. -s Count : Specifies that the Internet Timestamp option in the IP header is used to record the time of arrival for the Echo Request message and corresponding Echo Reply message for each hop. The Count must be a minimum of 1 and a maximum of 4. -j 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 host list is a series of IP addresses (in dotted decimal notation) separated by spaces. -k HostList : Specifies that the Echo Request messages use the Strict Source Route option in the IP header with the set of intermediate destinations specified in HostList. With strict source routing, the next intermediate destination must be directly reachable (it must be a neighbor on an interface of the router). The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces. -w Timeout : Specifies the amount of time, in milliseconds, to wait for the Echo Reply message that corresponds to a given Echo Request message to be received. If the Echo Reply message is not received within the time-out, the "Request timed out" error message is displayed. The default time-out is 4000 (4 seconds). TargetName : Specifies the destination, which is identified either by IP address or host name.

    Rename (ren) Changes the name of a file or a set of files.

    Syntax rename [Drive:][Path] filename1 filename2 ren [Drive:][Path] filename1 filename2

    Top of page Parameters [Drive:][Path] filename1 : Specifies the location and name of the file or set of files you want to rename. filename2 : Specifies the new name for the file. If you use wildcards (* and ?), filename2 specifies the new names for the files. You cannot specify a new drive or path when renaming files.

    Rmdir (rd) Removes (that is, deletes) a directory.

    Syntax rmdir [Drive:]Path [/s] [/q] rd [Drive:]Path [/s] [/q]

    Top of page Parameters [Drive:]Path : Specifies the location and name of the directory that you want to delete. /s : Removes the specified directory and all subdirectories including any files. Use /s to remove a tree.

    /q : Runs rmdir in quiet mode. Deletes directories without confirmation.

    Set Displays, sets, or removes environment variables. Used without parameters, set displays the current environment settings.

    Syntax set [[/a [expression]] [/p [variable=]] string]

    Top of page Parameters /a : Sets string to a numerical expression that is evaluated.

    /p : Sets the value of variable to a line of input. variable : Specifies the variable you want to set or modify. string : Specifies the string you want to associate with the specified variable.

  • Shutdown Allows you to shut down or restart a local or remote computer. Used without parameters, shutdown will logoff the current user.

    Syntax shutdown [{-l|-s|-r|-a}] [-f] [-m [\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy]

    Top of page Parameters -l : Logs off the current user, this is also the defualt. -m ComputerName takes precedence. -s : Shuts down the local computer. -r : Reboots after shutdown. -a : Aborts shutdown. Ignores other parameters, except -l and ComputerName. You can only use -a during the time-out period. -f : Forces running applications to close. -m [\\ComputerName] : Specifies the computer that you want to shut down. -t xx : Sets the timer for system shutdown in xx seconds. The default is 20 seconds. -c "message" : Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks. -d [u][p]:xx:yy : Lists the reason code for the shutdown. The following table lists the different values.

    Value Description

    u Indicates a user code.

    p Indicates a planned shutdown code.

    xx Specifies the major reason code (0-255).

    yy Specifies the minor reason code (0-65536).

    Systeminfo Displays detailed configuration information about a computer and its operating system, including operating system

    configuration, security information, product ID, and hardware properties, such as RAM, disk space, and network cards.

    Syntax systeminfo[.exe] [/s Computer [/u Domain\User [/p Password]]] [/fo {TABLE|LIST|CSV}] [/nh]

    Top of page Parameters /s Computer : Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. /u Domain\User : Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command. /p Password : Specifies the password of the user account that is specified in the /u parameter. /fo {TABLE|LIST|CSV} : Specifies the format to use for the output. Valid values are TABLE, LIST, and CSV. The default format for output is LIST. /nh : Suppresses column headers in the output. Valid when the /fo parameter is set to TABLE or CSV.

    System File Checker (sfc) Scans and verifies the versions of all protected system files after you restart your computer.

    Syntax sfc [/scannow] [/scanonce] [/scanboot] [/revert] [/purgecache] [/cachesize=x]

    Top of page Parameters /scannow : Scans all protected system files immediately. /scanonce : Scans all protected system files once.

  • /scanboot : Scans all protected system files every time the computer is restarted. /revert : Returns the scan to its default operation. /purgecache : Purges the Windows File Protection file cache and scans all protected system files immediately. /cachesize=x : Sets the size, in MB, of the Windows File Protection file cache.

    Telnet commands The telnet commands allow you to communicate with a remote computer that is using the Telnet protocol. You can

    run telnet without parameters in order to enter the telnet context, indicated by the Telnet prompt (telnet>). From

    the Telnet prompt, use the following commands to manage a computer running Telnet Client.

    The tlntadmn commands allow you to remotely manage a computer running Telnet Server. These commands are

    run from the command prompt. Used without parameters, tlntadmn displays local server settings.

    To use telnet commands at the Telnet prompt

    To start Telnet Client and to enter the Telnet prompt

    Syntax telnet [\\RemoteServer]

    Top of page

    Parameters \\RemoteServer : Specifies the name of the server to which you want to connect.

    Tracert Determines the path taken to a destination by sending Internet Control Message Protocol (ICMP) Echo Request messages to the destination with incrementally increasing Time to Live (TTL) field values. The path displayed is the list of near-side router interfaces of the routers in the path between a source host and a destination. The near-side interface is the interface of the router that is closest to the sending host in the path. Used without parameters, tracert displays help.

    Syntax tracert [-d] [-h MaximumHops] [-j HostList] [-w Timeout] [TargetName]

    Top of page Parameters -d : Prevents tracert from attempting to resolve the IP addresses of intermediate routers to their names. This can speed up the display of tracert results. -h MaximumHops : Specifies the maximum number of hops in the path to search for the target (destination). The default is 30 hops. -j HostList : Specifies that 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. -w Timeout : Specifies the amount of time in milliseconds to wait for the ICMP Time Exceeded or Echo Reply message corresponding to a given Echo Request message to be received. If not received within the time-out, an asterisk (*) is displayed. The default time-out is 4000 (4 seconds). TargetName : Specifies the destination, identified either by IP address or host name.

    Tree Graphically displays the directory structure of a path or of the disk in a drive.

    Syntax tree [Drive:][Path] [/f] [/a]

    Top of page

    Parameters Drive: : Specifies the drive that contains the disk for which you want to display the directory structure. Path : Specifies the directory for which you want to display the directory structure. /f : Displays the names of the files in each directory.

  • /a : Specifies that tree is to use text characters instead of graphic characters to show the lines linking subdirectories.

    Xcopy Copies files and directories, including subdirectories.

    Syntax xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n] [/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

    Top of page Parameters Source : Required. Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path. Destination : Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination of these. /w : Displays the following message and waits for your response before starting to copy files: Press any key to begin copying file(s) /p : Prompts you to confirm whether you want to create each destination file. /c : Ignores errors. /v : Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files. /q : Suppresses the display of xcopy messages. /f : Displays source and destination file names while copying. /l : Displays a list of files that are to be copied. /g : Creates decrypted destination files. /d[:mm-dd-yyyy] : Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed. /u : Copies files from Source that exist on Destination only. /i : If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopyprompts you to specify whether Destination is a file or a directory.

    /s : Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory. /e : Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options. /t : Copies the subdirectory structure (that is, the tree) only, not files. To copy empty directories, you must include the /e command-line option. /k : Copies files and retains the read-only attribute on destination files if present on the source files. By default, xcopy removes the read-only attribute. /r : Copies read-only files. /h : Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files. /a : Copies only source files that have their archive file attributes set. /a does not modify the archive file attribute of the source file. For information about how to set the archive file attribute by using attrib, see Related Topics. /m : Copies source files that have their archive file attributes set. Unlike /a, /m turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Related Topics. /n : Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the destination file system. The destination file system can be FAT or NTFS. /o : Copies file ownership and discretionary access control list (DACL) information. /x : Copies file audit settings and system access control list (SACL) information (implies /o). /exclude:filename1[+[filename2]][+[filename3]] : Specifies a list of files containing strings. /y : Suppresses prompting to confirm that you want to overwrite an existing destination file. /-y : Prompts to confirm that you want to overwrite an existing destination file. /z : Copies over a network in restartable mode.

    Commands listed above are taken from http://tinyurl.com/okfme.