|
BASIC WINDOWS COMMANDS
|
|
08-04-2009, 01:25 AM
Post: #1
|
|||
|
|||
|
BASIC WINDOWS COMMANDS
When Windows does not boot, a technician must work from a command prompt. Some of
the most frequently used commands are outlined below. Items enclosed by brackets are optional. Items in italics are command specific values that you must enter. When the items are separated by a | (bar), one of the items must be typed. Note that not all options shown may be available when using Recovery Console. Recovery Console is a boot option or is executed from a CD in 2000 Professional or XP. Some commands have different options when used within Recovery Console. ATTRIB This command is used to control the attribute for a file or folder. Syntax: attrib [+|-c] [+|-h] [+|-r] [+|-s] [drive:] [path] filename Explanation: + adds an attribute. - takes an attribute away. c is the compressed attribute. h is the hidden attribute. r is the read-only attribute. s is the system attribute. [drive:] is the drive where the file is located. [path] is the directory/subdirectory where the file is located. filename is the name of the file. Example: attrib +h c:\cheryl.bat sets the attribute to hidden for a file called CHERYL.BAT located on the hard drive. Notes: The DIR command (typed without any switches) is used to see what attributes are currently set. You may set more than one attribute at a time. BOOTCFG This command is used to change, delete, configure, or query entries set in theBOOT.INI file. Syntax when used from a command prompt within the operating system: bootcfg [/copy | /delete | /query | /raw | /timeout | /default | /ems | /debug | /addsw | /rmsw | /dbg1394] [arguments] Syntax when used from Recovery Console: bootcfg [/add | /rebuild | /scan | /list | /disableredirect | /redirect [port_number baud_rate] | useBiosSettings] | /redirect | /default] Explanation: [/copy] creates a copy of the current boot entry [operating systems] section ofBOOT.INI and this can be used to add options. [/delete] is used to delete the existing boot entry [operating systems] section of BOOT.INI. An argument must be used to specify which boot entry is to be deleted. [/query] displays the current boot entries. [/raw] allows the user to specify switch options for a specific boot entry in theBOOT.INI file. [/timeout] is used to change the timeout value for the BOOT.INI file. [/default] is used to change the default operating system defined in the BOOT.INI file. [/ems] allows the /redirect switch to be configured. [/debug] is used to configure the port and speed for debugging a boot entry found in the BOOT.INI file. [/addsw] allows a user to add predefined switches for a specific boot entry. [/rmsw] allows a user to remove a predefined switch for a specific boot entry. [/dbg1394] allows a user to configure the FireWire port to debug a specific boot entry. [arguments] are options normally available with a specific command. To see what arguments are available for a specific parameter type bootcfg, then a forward slash (/ ), then the specific parameter such as copy or delete, press the space bar once, and type /?. An example is bootcfg /copy /?. [/add] adds a windows installation to the boot list. [/rebuild] iterates through all Windows installations and allows the user to choose which installation to add to the boot list. [/scan] checks all disks for Windows installations. [/list] lists entries contained in the current boot list. [/disableredirect] disables redirection of the boot loader. [/redirect [port_number baud_rate | useBiosSettings] enables redirection in the boot loader. An example is bootcfg /redirct com1 115200. Example: bootcfg /delete /id 1 deletes the second boot entry from the BOOT.INI file. CD This command is used to navigate through the directory structure. Syntax: cd [drive:] [path] [..] Explanation: [drive:] specifies the drive (if a different one than the current drive) to which you want to change. [path] is the directory/subdirectory to reach the folder. [..] is used to change to the parent directory (moves you back one directory). Example: C:\WINNT>cd.. C:\ This command moves you from the WINNT directory (folder) to the parent directory, which is the root directory (C:\). C:\>cd \WINNT This command moves you from the root directory to the WINNT directory on the C: drive. CHKDSK This command checks a disk for physical problems, lost clusters, cross-linked files, and directory errors. If necessary, the chkdsk command repairs the disk, marks bad sectors, recovers information, and displays the status of the disk. Syntax: chkdsk [drive:] [/p] [/r ] [/c] [/f] [/i] [/l:size] [/v] [/x] Explanation: [drive:] specifies the drive to check. [/p] forces the chkdsk check even if the volume is not identified as being bad. [/r] locates bad sectors and attempts recovery of the sector’s information. [/c] skips cycle checking of NTFS volume folders. [/f] fixes drive errors. [/i] checks only index entries on NTFS volumes. [/l:size] the /l: must be part of the command followed by the size (in kilobytes) of the log file for NTFS volumes. [/v] With a FAT volume, the /v switch shows the full path for every file.With a NTFS volume, cleanup messages are displayed. [/x]With NTFS, the switch forces the volume to dismount before checking the volume. Example: chkdsk d: This command checks the disk structure on the D: drive. Notes: This command can be used without switches. In order for this command to work, the AUTOCHK.EXE must be loaded in the SYSTEM32 folder or used with the correct path and run from the Windows CD. CLS The cls command clears the screen of any previously typed commands. Example: C:\WINNT>cls CMD The cmd command is executed from the RUN dialog box. (Click on Start button, click on Run option, and type CMD.EXE in the dialog box.) A DOS window appears. Type EXIT from the DOS window to close the window. Syntax: cmd [/c string] Explanation: [/c string] specifies that the command interpreter is to perform the command specified by the string option and then stop. Example: cmd /c chkdsk d: This command runs the chkdsk program on the D: hard drive volume using the command line. Notes: This command is not available in Recovery Console. COPY The copy command is used to copy a single file to the destination that you specify. Syntax: copy source [target] Explanation: source is the file that you want to copy and it includes the drive letter and the path if it is different from your current location. [target] is the location you want to put the file and it includes the drive letter and path if it is different from your current location. Example: copy c:\cheryl.bat a:\ This command takes a file called CHERYL.BAT that is located in the root directory of the hard drive and copies it to the floppy drive. Notes: You cannot use wildcard characters such as * and ? with this command in the Recovery Console. You do not have to put a target if the file is going to the current location specified by the command prompt. If a file already exists, you will be prompted whether or not to overwrite the file. Compressed files that are copied from the Windows CD are automatically uncompressed to the hard drive as they are copied. DEL The del command is used to delete a file. Syntax: del name [/p] [/f] [/s] [/q] [/a] Explanation: name is the file or directory (folder) that you want to delete and it includes the drive letter and the path if it is different from your current location. [/p] is used to prompt for confirmation before deleting. [/f] is used to force read-only files to be deleted. [/s] is used to delete files from all subdirectories. [/q] means quiet mode, which does not prompt for confirmation. [/a] is used to select files based on their attribute where the attributes are R, H, S, and A.A+ (plus sign) before the attribute means “select it” and a − (minus sign) before the attribute means “do not select it.” Example: C:\WINNT>del c:\cheryl.bat This command deletes a file called CHERYL.BAT that is located in the WINNT directory on the hard drive. Notes: You cannot use wildcard characters such as * and ? with this command while in the Recovery Console. DIR The dir command is used to list files and folders and their attributes. Syntax: dir [drive:] [path] [filename] [/a] [/b] [/c] [/d] [/l] [/n] [/o] [/p] [/q] [/s] [/t] [/w] [/x] [/4] Explanation: [drive:] is the drive letter where the files are located. [path] is the directory/subdirectory to reach the folder. [filename] is the name of a specific file. [/a] is used to display files that have specific attributes where the attributes are D, R, H, A, and S. D is for directories; R is for read-only; H is for hidden; A is for archive; and S is for system files. A + (plus sign) before the attribute means “select it” and a − (minus sign) before the attribute means “do not select it.” [/b] is for barebones format (it does not show heading or summary information). [/c] shows the file sizes with the thousands separator. [/d] displays the file listing in a wide format sorted by column. [/l] displays the listing in lowercase. [/n] displays the listing in long list format. [/o] displays the listing in sorted order. Options you can use after the “o” are E, D, G, N, and S. E is by alphabetic file extension; D is by date and time with the oldest listing shown first; G shows the directories listed first; N displays by alphabetic name; and S displays by size from smallest to largest. [/p] displays the information one page at a time. [/q] displays the owner of the file(s). [/s] includes subdirectories in the listing. [/t] controls which specific time field is shown where the types of time fields are A, C, and W. A is for the last access date/time with the earliest shown first; C is for the creation date/time; and W is for the last written date/time. [/w] shows the listing in wide format. [/x] shows the 8.3 filename listing for long filenames. [/4] displays four digit years instead of two digit years. Example: dir c:\winnt This command shows all of the files and folders (and their associated attributes) for the WINNT folder that is located on the C: drive. Notes: You can use wildcard characters such as * and ? with this command in the Recovery Console. The attributes you can see are (1) a for archive, (2) c for compressed, (3) d for directory, (4) e for encrypted, (5) h for hidden, (6) p for reparse point, (7) r for read-only, and (8) s for system file. DISABLE The disable command is used to disable a system service or hardware driver. Syntax: disable name Explanation: name is the name of the service or driver that you want to disable. Notes: You can use the listsvc command to show all services and drivers that are available for you to disable. Make sure that you write down the previous START_TYPE before you disable the service in case you need to restart the service. DISKCOPY The diskcopy command is used to make an exact copy of one disk and put it on another. Syntax: diskcopy [drive1:] [drive2:] [/v] Explanation: [drive1:] is the source drive letter followed by a : (colon). [drive2:] is the destination drive letter followed by a : (colon). [/v] is used to verify the files that have been copied. Example: C:\WINNT>diskcopy a: a: Notes: The drive letters are only needed if the command prompt is a different drive and location. This command is not available in Recovery Console. DISKPART The diskpart command is used to manage and manipulate the hard drive partitions. Syntax: diskpart [/add|/delete] [devicename] [drivename|partitionname] [size]. Explanation: [add |delete] is used to create a new partition or delete an existing partition. [devicename] is the name given to the device when creating a new partition such as \Device\HardDisk0. [drivename] is the drive letter used when deleting an existing partition such as E:. [partitionname] is the name used when deleting an existing partition and can be used instead of the drivename option. An example of a partitionname is Device\HardDisk0\Partition2. [size] is used when creating a new partition and is the size of the partition in megabytes. Notes: You can just type the diskpart command without any options and a user interface appears that helps when managing hard drive partitions. ENABLE This command is used to enable a system service or hardware driver. Syntax: enable name [start-type] Explanation: name is the name of the service or driver that you want to disable. [start-type] is when you want the service or driver scheduled to begin. Valid options are as follows: SERVICE_BOOT_START SERVICE_SYSTEM_START SERVICE_AUTO_START SERVICE_DEMAND_START Notes: You can use the listsvc command to show all services and drivers that are available for you to enable. Make sure that you write down the previous value before you enable the service in case you need to restart the old service or driver. EXIT The exit command closes Recovery Console and restarts the computer. When an operating system is loaded and a MS-DOS window is open, the exit command closes the MS-DOS window. Example: C:\WINNT>exit EXPAND The expand command is used to uncompress a file from the Windows CD or a CAB file. A CAB file is a shortened name for a cabinet file. A CAB file holds multiple files or drivers that are compressed into a single file. Cabinet files are normally located in the i386 folder on the Windows CD. Technicians frequently copy the CAB files onto the local hard drive, so that when hardware and/or software is installed, removed, or reinstalled, the Windows CD does not have to be inserted. Syntax: expand source [/f:filespec] [destination] [/y] [/d] Explanation: source is the name of the file including the path that you want to uncompress. [/f:filespec] is the parameter used if a source contains more than one file. [destination] is the path to where you want to place the uncompressed file. [/y] is the parameter used if no overwrite prompt is desired. [/d] is the parameter used when the folder that is contained in the source parameter is not to be expanded. Example: expand d:\i386\access.cp_ c:\winnt\system32\access.cpl expands (uncompresses) the compressed file ACCESS.CP_ and puts it into the C:\WINNT\SYSTEM32 folder with the name ACCESS.CPL. Notes: You may not use wildcard characters with the source parameter. You may use wildcard characters with the /f:filespec parameter. FIXBOOT This command is used to rewrite the hard drive’s boot sector. Syntax: fixboot [driveletter:] Explanation: [driveletter:] is the drive letter (and a colon) of the hard drive volume that you want to place in a new boot sector. Example: fixboot c: Notes: If you do not specify the driveletter: parameter, the boot sector that is repaired is the system boot volume’s boot sector. FIXMBR This command rewrites the startup partition’s Master Boot Record. Syntax: fixmbr [name] Explanation: [name] is the name of the device that you want to repair its Master Boot Record. Example: fixmbr \Device\HardDisk0 Notes: If you do not type in the name parameter, Disk 0 is the default. Use the map command to see valid device names. Run a virus checker before using this command. FORMAT The format command is used to format a disk and can be used to format it for a particular file system. Syntax: format [driveletter:] [/q] [/fs:filesystem] [/a:size] [/c] [/f:size] [/n:sectors] [/t:tracks] [/v:label] [/x] [/1] [/4] [/8] Explanation: [driveletter:] is the drive letter for the disk or hard drive volume that you want to format. [/q] is the parameter used if you want to perform a quick format. [/fs:filesystem] is the parameter used if you want to specify a file system. Valid values are as follows: FAT FAT32 NTFS [/a:size] The /a: must be part of the command followed by the default allocation unit size. The different units supported by the three file systems are listed below. NTFS : 512, 1024, 2048, 4096, 8192, 16K, 32K, and 64K FAT : 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K, and (128K, 256K for sector size that is larger than 512 bytes) FAT32 : 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K, and (128K, 256K for sector size that is larger than 512 bytes) [/c] is used to compress the files on the volume by default. [/f:size] The /f: must be part of the command followed by the size for floppy disk to format. The different sizes supported are as follows: 160, 180, 320, 360, 640, 720, 1.2, 1.44, 2.88, or 20.8. [/n:sectors] The /n: must be part of the command followed by the number of sectors per track. [/t:tracks] The /t: must be part of the command followed by the number of tracks per disk side. [/v:label] The /v: must be part of the command followed by the name of the volume assigned. [/x] is used to dismount the volume first, if necessary. [/1] is used to format a single side of a floppy disk. [/4] is used to format a 5.25 360K floppy disk in a 1.2M drive. [/8] is used to format eight sectors per track. Example: format c: /fs:ntfs Notes: If no /fs:filesystem parameter is specified, the NTFS file system is used. FAT is FAT16. FAT16 hard drive volumes cannot be more than 4GB in size, but should be formatted to 2GB to be compatible with DOS, Windows 3.x, and Windows 9x. HELP This command displays information about specific Recovery Console commands. Syntax: help [command] Explanation: [command] is the name of the command for which you want help. Example: help expand Notes: If you do not specify the command parameter when using the Help command, all Recovery Console commands are listed. LISTSVC This command lists all of the services, hardware drivers, and their start-types. The listsvc command is useful to use before using the disable or enable command. Syntax: listsvc Example: C:\WINNT>listsvc LOGON The logon command is used to list all Windows 2000, NT, and XP installations and prompts for the local administrator password. MAP This command is used to list the computer’s drive letters, types of file systems, volume sizes, and physical device mappings. Syntax: map [arc] Explanation: [arc] is the Advanced RISC Computing path instead of the Windows device paths. This parameter is used when you are repairing or recreating the BOOT.INI file. MD This command is used to create a directory (folder). Syntax: md [driveletter:] [dirname] Explanation: [driveletter:] is the drive letter for the disk or volume on which you want to create a directory (folder). It can also include the path. [dirname] is the parameter used to name the directory (folder). Example: md c:\TEST Notes: You may not use wildcard characters with this command. The MKDIR command can also be used to create a directory. MORE The more command is used to display a text file. Syntax: more filename [/c] [/e] [/p] [/s] [/t#] Explanation: filename is the path and name of the text file you want to display on the screen. [/c] clears the screen before displaying a page of information. [/e] enables extended features. [/p] expands form feed characters. [/s] takes multiple blank lines and condenses them into one blank line. [/t#] The /t must be part of the command followed by the number of spaces used to expand tabs. The normal setting is eight spaces. Example: more c:\boot.ini Notes: The spacebar allows you to view the next page of a text file. The Enter key allows you to scroll through the text file one line at a time. The ESC key allows you to quit viewing the text file. NET USE The net use command is used to attach to a remote network device. Syntax: net use [\\server_name\share_name /user:domain_name\user_name [password] | drive_letter /d] Explanation: \\server_name is the name of the network device to which to connect. share_name is the name of the share. domain_name is the domain used to validate the user. user_name is the user to be validated. [password] is an optional entry so the system does not prompt for a password. If this option is not entered, a password prompt appears and the system automatically assigns a drive letter once a connection is made. drive_letter is the letter and colon that NET USE assigns to the network device connection. /d specifies that the network connection is to be disconnected. Example: net use \\ATC227-01\cisco /user:cisco\student Notes: There are other NET commands that can be used from a command prompt, but not the Recovery Console. RD This command is used to remove a directory (folder). Syntax: rd [driveletter:] [path] Explanation: [driveletter:] is the drive letter for the disk or hard drive volume from which you want to remove a directory (folder). [path] is the optional path and name of the directory (folder) you want to remove. Example: rd c:\TEST\JUNKDATA removes a directory (folder) called JUNKDATA that is a subdirectory under a directory (folder) called TEST. This directory is located on the hard drive (C .Notes: You do not have to use the driveletter: parameter if the default drive letter is the same as the one that contains the directory to be deleted. REN The ren command is used to rename a file or directory (folder). Syntax: ren [driveletter:] [path] name1 name2 Explanation: [driveletter:] is the drive letter for the disk or hard drive volume in which you want to rename a file or a directory (folder). [path] is the optional path telling the operating system where to find the file or directory (folder) you want to rename. name1 is the old name of the file or directory (folder) that you want to rename. name2 is the new name of the file or directory (folder). Example: ren c:\cheryl.bat c:\newcheryl.bat Notes: The renamed file cannot be placed in a new location with this command. Move or copy the file after you rename it if that is what you want to do. The * and ? wildcard characters are not supported. SET The set command is used to display and view different Recovery Console variables. Syntax: set [variable = value] Explanation: variable is one of the following: AllowWildCards, which is the variable used to enable wildcard support for the commands that normally do not support wildcards. AllowAllPaths, which is the variable that allows access to all of the computer’s files and folders. AllowRemovableMedia, which is the variable that allows files to be copied to removable media (floppy disk). NoCopyPrompt, which is the variable that disables prompting when overwriting a file. value is the setting associated with the specific variable. Notes: To see all of the current settings, type set without a variable and the current settings display. The set command can be used only if it is enabled using the Group Policy snap-in. SYSTEMROOT The systemroot command sets the current directory as the system root. Syntax: systemroot Notes: The SYSTEMROOT command is only available through Recovery Console. TYPE The type command is used to display a text file. Syntax: type filename Explanation: filename is the path and name of the text file you want to display on the screen. Example: type c:\boot.ini Notes: The spacebar allows you to view the next page of a text file. The Enter key allows you to scroll through the text file one line at a time. The ESC key allows you to quit viewing the text file. WSCRIPT The wscript.exe is the command used to bring up a Windows-based script property sheet. This property sheet is used to set script properties. The command line version is CSCRIPT.EXE. Pc Laptop Repair |
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help
Contact Us

.

