1.
ATTRIB: Attrib allows a user to change the properties of a
specified file. Using attrib, the user has the capability of changing the
file to have any of the below attributes.
1. SYNTAX:
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path]
filename] [/S [/D]]
Examples:
1. C:\Users\sudhakar>attrib -r
Not resetting hidden file - C:\Users\sudhakar\NTUSER.DAT
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG1
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG2
2. C:\Users\sudhakar >attrib -a
Not resetting hidden file - C:\Users\sudhakar\NTUSER.DAT
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG1
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG2
3. C:\Users\sudhakar>attrib -s
Not resetting hidden file - C:\Users\sudhakar\NTUSER.DAT
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG1
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG2
4. C:\Users\sudhakar>attrib -a
Not resetting hidden file - C:\Users\sudhakar\NTUSER.DAT
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG1
Not resetting hidden file - C:\Users\sudhakar\ntuser.dat.LOG2
5. C:\Users\sudhakar>attrib /s
C:\Users\sudhakar\Pictures\Sample Pictures.lnk
C:\Users\sudhakar\Saved Games\desktop.ini
C:\Users\sudhakar\Searches\desktop.ini
6. C:\Users\sudhakar>attrib /s /d
C:\Users\sudhakar\Office2010
C:\Users\sudhakar\Pictures
C:\Users\sudhakar\PrintHood
2. MSD : Assists Microsoft support personnel in obtaining detailed
technical information about your computer.
Syntax: MSD [/B] [/I] [/F filename] [/P filename] [/S [filename]]
Examples:
msd/i
Run MSD without scanning for additional hardware that may not be
detected.
3. PROMPT : Allows you to change the MS-DOS prompt to display
more or less information.
EXAMPLE:
C:\Users\sudhakar>prompt
4.PRINT : This command allowed users to print a text file to a line
printer, in the background.
Syntax
print /d:device /b:size /u:ticks1 /m:ticks2 /s:ticks3 /q:size /t drive:\
path\ filename /c /p
Options:
/d:device Name of printer device
Printer Ports: LPT1, LPT2 orLPT3
Serial Ports: Com1, Com2, Com3 or Com4
/b:size Sets size (in bytes) of internal buffer. Default=512 with
range of 512 to 16384.
/u:ticks1 Maximum number of clock ticks PRINT is to wait for a
printer to become available. Default=1 with a range of
1 to 255.
/m:ticks2 Maximum number of clock ticks PRINT can take to print a
character or printer. Default=2 with a range of 1 to 255.
/s:ticks3 Maximum number of clock ticks allocated for background
printing. Default=8 with range of 1 to 255.
/q:qsize Maximum number of files allowed in print queue.
Default=10 with range of 1 to 255.
/t Removes files from the print queue.
drive:\path\ Location and filename of file to be printed.
filename
/c Removes files from the print queue.
/p Adds files to the print queue.
Examples
C:\Users\sudhakar>print C:\file.txt /d:lpt1
Unable to initialize device lpt1
5. RENAME OR REN: Used to rename files and directories from
the original name to a new name.
Syntax :
RENAME [drive:][path][directoryname1 | filename1]
[directoryname2 | filename2]
REN [drive:][path][directoryname1 | filename1] [directoryname2 |
filename2]
Note that you cannot specify a new drive or path for your
destination.
Examples
C:\Users\sudhakar>rename c:\foit FOIT
C:\Users\sudhakar>rename c:\foit\new.txt new1.txt
6. FSUTIL: The fsutil command is used to perform various FAT and
NTFS file system tasks like managing reparse points and sparse
files, dismounting a volume, and extending a volume.
EXAMPLE
C:\Users\sudhakar>fsutil file createnew c:\foit\new.txt 1000
File c:\foit\new.txt is created
7. LABEL: Label is used to view or change the label of the
computer disk drives. Creates, changes, or deletes the volume label
of a disk.
Syntax:
LABEL [drive:][label]
Examples
C:\Users\sudhakar>label c:
Volume in drive C: has no label
Volume Serial Number is 00CE-8A14
Volume label (32 characters, ENTER for none)? New
8. MKDIR: Allows you to create your own directories in MS-DOS.
Syntax: MKDIR [drive:]path
Examples
C:\Users\sudhakar>mkdir c:\c
C:\Users\sudhakar>mkdir c:\c\d
C:\Users\sudhakar>md cr
9. REPLACE: This command replaces files in the target path
designation with files of the same name in the source location.
Syntax:
REPLACE [d:][path]filename [d:][path][/A][/P][/R][/S][/U][/W]
Examples
C:\Users\sudhakar>replace c:\foit\new1.txt c:\ /a
Adding C:\new1.txt
C:\Users\sudhakar>replace c:\foit\new1.txt c:\ /s
Replacing C:\new1.txt
C:\Users\sudhakar>replace c:\foit\qi.txt c:\ /p
C:\Users\sudhakar>replace c:\foit\qi.txt c:\ /r
C:\Users\sudhakar>replace c:\foit\qi.txt c:\ /U
C:\Users\sudhakar>replace c:\foit\qi.txt c:\ /W
Press any key to continue . . .
10. CHDIR OR CD: Chdir (Change Directory) is a command used
to switch directories in MS-DOS.
Syntax
CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]
Examples: C:\Users\sudhakar>CD..
C:\Users>CD sudhakar
C:\Users\sudhakar>cd\
C:\>chdir Users\sudhakar
C:\Users\sudhakar>chdir \
C:\>
11. CLS: Cls is a command that allows a user to clear the complete
contents of the screen and leave only a prompt.
Syntax: CLS
Examples : cls
12. CMD: The command.com is the command interpreter for MS-
DOS and is required for Microsoft operating systems. Without
command.com the computer running a Microsoft operating system
would be unable to boot.
Syntax:
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON |
/V:OFF] [[/S] [/C | /K] string]
EXAMPLES:
1. C:\Users\sudhakar>cmd /c set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\sudhakar\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
2. C:\Users\sudhakar>cmd /k set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\sudhakar\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
3. C:\Users\sudhakar>cmd /s call
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
4. C:\Users\sudhakar>cmd /q call
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
5. C:\Users\sudhakar>cmd /d assoc
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
6. C:\Users\sudhakar>cmd /a start
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
7. C:\Users\sudhakar>cmd /t:fg
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
13. COPY: Allows the user to copy one or more files to an
alternate location.
Syntax:
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination]
[/A | /B]] [/V] [/Y | /-Y]
Examples:
C:\Users\sudhakar>copy /b c:\new.txt c:\FOIT\qi.txt /b /v /y
1 file(s) copied.
C:\Users\sudhakar>copy /b c:\new.txt c:\FOIT\qi.txt /b /v /-y
Overwrite c:\FOIT\qi.txt? (Yes/No/All): yes
1 file(s) copied.
14. DEBUG: Debug is a method of looking at portions of your
computer and writing assembly code to perform certain tasks on
your computer.
Syntax:
DEBUG [[drive:][path]filename [testfile-parameters]]
Examples:
C:\Users\sudhakar>debug
-d40:00
0040:0000 F8 03 F8 02 E8 03 E8 02-BC 03 78 03 78 02 80
9E ..........x.x...
0040:0010 22 C8 00 80 02 20 00 20-00 00 30 00 30 00 71 10
".... . ..0.0.q.
0040:0020 0D 1C 64 20 34 05 30 0B-3A 27 30 0B 30 0B 0D 1C ..d
4.0.:'0.0...
0040:0030 20 00 20 00 20 00 20 00-20 00 20 00 20 00 00 00 . . . . . . ...
-q
15. DELTREE: Short for delete tree, deltree is a command used
to delete files and directories permanently from the computer.
Syntax:
To delete one or more files and directories:
DELTREE [/Y] [drive:]path [[drive:]path[...]]
Examples:
C:\Users\sudhakar>del c:\c
C:\c\*, Are you sure (Y/N)? y
16. DOSKEY: Doskey is a MS-DOS utility that allows a user to keep
a history of commands used on the computer. This allows frequently
used commands to be used without having to type the commands in
each time you need to use it.
Syntax: DOSKEY [/switch ...] [macroname=[text]]
Examples:
to create a batch program named MACINIT.BAT that includes all Doskey
macros
doskey /macros > macinit.bat
Creates a batch program named TMP.BAT that contains recently used
commands
doskey /history > tmp.bat
defines a macro with multiple commands, use $T to separate
commands
doskey tx=cd\temp$tdir/w $*
The macro first creates a new directory and then changes to it from
the current directory.
doskey mc=md $1$tcd $1
use the preceding macro to create and change to a directory named
BOOKS
mc books
create a macro that uses batch parameters for moving a file or group
of files
doskey mv=copy $1 $2 $t del $1
Create a macro that causes the MEM command to pause after each
screen
doskey mem=mem $* /p
17. ECHO: Echo is used to repeat the text typed in back to the
screen and can be used to echo to a peripheral on the computer,
such as a COM port.
Syntax:
Displays messages, or turns command-echoing on or off.
ECHO [ON | OFF]
ECHO [message]
Type ECHO without parameters to display the current echo setting.
Examples:
C:\Users\sudhakar>echo
ECHO is on.
C:\Users\sudhakar>echo how r u > tex.txt
18. EDIT: The MS-DOS Editor is a command line text editor that
allows you to to view, create, or modify any file on your computer.
Syntax:
EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)
Examples:
1. C:\Users\sudhakar>edit /b tex.txt
Opens d file in dos window n u can edit
2. C:\Users\sudhakar>edit /h tex.txt
Open d file in dos window n shows how many total lines available
3. C:\Users\sudhakar>edit /?
MS-DOS Editor Version 2.0.026 Copyright (c) Microsoft Corp 1995.
EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]
/B - Forces monochrome mode.
/H - Displays the maximum number of lines possible for your
hardware.
/R - Load file(s) in read-only mode.
/S - Forces the use of short filenames.
/<nnn> - Load binary file(s), wrapping lines to <nnn> characters wide.
/? - Displays this help screen.
[file] - Specifies initial files(s) to load. Wildcards and multiple
filespecs can be given.
4. C:\Users\sudhakar>edit /b tex.txt
Open d file in dos window n u can only read i
19. FC: FC, or file compare, is used to compare two files against
each other. Once completed, fc will return lines that differ between
the two files. If no lines differ, you will receive a message indicating
no differences encountered.
Syntax
FC [/A] [/C] [/L] [/N] [/T] [/W] [drive1:][path1]filename1 [drive2:]
[path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
Examples:
1. C:\Users\sudhakar>fc /a text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
2. C:\Users\sudhakar>fc /b text.txt tex.txt
Comparing files text.txt and TEX.TXT
00000001: 4F 6F
00000008: 64 0D
00000009: 65 0A
FC: text.txt longer than TEX.TXT
3. C:\Users\sudhakar>fc /c text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
hOw r u dear??
***** TEX.TXT
How r u
*****
4. C:\Users\sudhakar>fc /l text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
5. C:\Users\sudhakar>fc /N text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
1: hOw r u dear??
***** TEX.TXT
1: how r u
*****
6. C:\Users\sudhakar>fc /T text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
7. C:\Users\sudhakar>fc /W text.txt tex.txt
Comparing files text.txt and TEX.TXT
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
20. FOR: The FOR variable is used for batch files to run a specified
command when a parameter is met or specified.
SYNTAX:
FOR %variable IN (set) DO command [command-parameters]
Examples
for /F %%A in ("pics.txt") do If %%~zA equ 0 del pics.txt
In the above example, if the file pics.txt was found in the current
directory and was equal to 0 in file size, that file would be deleted.
21. SORT: Sorts the input and displays the output to the screen.
Syntax:
SORT [/R] [/+n] [/M kilobytes] [/L locale] [/RE recordbytes]
[[drive1:][path1]filename1] [/T [drive2:][path2]]
[/O [drive3:][path3]filename3]
Examples:
1. C:\Users\sudhakar>sort<tex.txt> r.txt
Sorts data of tex.txt in saves it in r.txt
2. C:\Users\sudhakar>sort /r<text.txt> wow.txt
Sorts data of text.txt in rev order n saves in wow.txt
3. C:\Users\sudhakar>sort /+5<text.txt> wow.txt
Sorts data of file text.txt based on 5th char of each line
22. START NOTEPAD: This command will cause the Windows
Notepad text editor program to be run.
SYNTAX: notepad filename
This command will cause the file named filename to be opened by the
Notepad text editor.
EXAMPLE:
notepad mylist.txt would open the mylist.txt file.
If the file filename does not exist, Notepad will ask you if you want to
create a new file with that name.
23. TIME: Allows the user to view and edit the computer's time.
Syntax
TIME [time]
Examples
C:\Users\sudhakar>time
The current time is: 2:50:40.49
Enter the new time: 2:51:10.10
24. VER: Displays the version of MS-DOS or if running Windows 95
or above the version of Windows.
Syntax: VER
Examples:
C:\Users\sudhakar>ver
Microsoft Windows [Version 6.1.7601]
25. VOL: Displays the volume information about the designated
drive.
Syntax: VOL [drive:]
Examples
C:\Users\sudhakar>vol c:
Volume in drive C has no label.
Volume Serial Number is 00CE-8A14
26. MOVE: Allows you to move files or directories from one folder
to another, or from one drive to another.
Syntax:
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
Examples
1. C:\Users\sudhakar>move /-y c:\c\qi.txt c:\FOIT\qi.txt
Overwrite c:\FOIT\qi.txt? (Yes/No/All): yes
1 file(s) moved.
2. C:\Users\sudhakar>move /y c:\c\q.txt c:\FOIT\qi.txt
1 file(s) moved.
3. C:\Users\sudhakar>move /y c:\c c:\FOIT
1 dir(s) moved.
27. PATH: Path is used to specify the location where MS-DOS looks
when using a command. For example, when using the command
"format", if the path is not specified to where the command is you
will receive bad command or file name.
Syntax:
PATH [[drive:]path[;...]]
PATH ;
Type PATH ; to clear all search-path settings and direct Windows to
search only in the current directory.
Type PATH without parameters to display the current path.
Examples:
C:\Users\sudhakar>path
PATH=C:\Program Files\RSA SecurID Token Common;C:\Windows\
system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft
Application Virtualization Client;C:\Program Files\ThinkPad
28. PUSHD: Stores a directory or network path in memory so it
can be returned to at any time.
Syntax:
PUSHD [path | ..]
path specifies the directory to make the current directory.
Examples:
C:\Users\sudhakar>PUSHD
The current directory ie C:\Users\sudhakar would be stored.
29. QCONFIG: Displays detailed technical information about your computer.
SYNTAX:
QCONFIG [/?][/A][/C][/D][/E][/I][/O[file]][/P][/Q] [key="text"]
/? Displays this help information.
/A Displays all Micro Channel adapters supported by QCONFIG.
/C Displays additional detail on async ports.
/D Displays a detailed listing of hardware.
/E Displays current environment.
/I Displays CONFIG.SYS & AUTOEXEC.BAT.
/O Redirects output to file QCONFIG.OUT.
/Ofile Redirects output to file (anyname).
/P Pauses the output between screens.
/Q Does not display redirect message.
key="text" Defines key with text to appear in output (must be last
option).
30. FINDSTR: The findstr command is short for find string and is a
command used in MS-DOS to locate files containing a specific string
of plain text.
Syntax:
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes][strings] [[drive:]
[path]filename[ ...]]
Examples:
C:\Users\sudhakar>findstr /b /e /l /r /s /i /x /v /n /m /o /p hello c:\foit\c
Hello how are
Hello are u mad
Any1 der??? Hello
31. HELP: Help is used to access the information and help file from
a MS-DOS prompt.
Syntax: HELP [command]
Examples: C:\Users\sudhakar>help
For more information on a specific command, type HELP command-
name
ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
32. MEM: Allows you to determine the available, used and free
memory.
Syntax:
MEM [/CLASSIFY | /DEBUG | /FREE | /MODULE module name] [/PAGE]
Examples:
1.C:\Users\sudhakar>mem /d
Address Name Size Type
------- -------- ------ ------
000000 000400 Interrupt Vector
000400 000100 ROM Communication Area
000500 000200 DOS Communication Area
2. C:\Users\sudhakar>mem /c
Total bytes available to programs (Conventional+Upper) : 629280
(614.5K)
Largest executable program size : 597840 (583.8K)
Largest available upper memory block : 28224 ( 27.6K)
3. C:\Users\sudhakar>mem /p
Shows the data can b rep on a single page
33. MORE: More allows information to be displayed one page at a
time.
Syntax:
MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < [drive:][path]filename
command-name | MORE [/E [/C] [/P] [/S] [/Tn] [+n]]
MORE /E [/C] [/P] [/S] [/Tn] [+n] [files]
Examples:
1. C:\Users\sudhakar>more /s /t12 <c:\foit\new.txt c:\foit\qi.txt|
more /s /t12
2. C:\Users\sudhakar>dir|more
Volume in drive C has no label.
Volume Serial Number is 00CE-8A14
Directory of C:\Users\sudhakar
08/28/2013 02:44 AM <DIR> .
08/28/2013 02:44 AM <DIR> ..
09/08/2012 09:17 PM <DIR> Contacts
08/27/2013 11:09 PM <DIR> cr
08/27/2013 11:10 PM <DIR> cr1
08/27/2013 11:12 PM <DIR> Desktop
08/27/2013 06:51 PM <DIR> Documents
34. BACKUP: MS-DOS application that enables users to backup
their data on their computer.
Syntax:
BACKUP [Source:\Path\Filename] [Target:] [/s] [/m] [/a] [/d:date]
[/t:time] [/f:size] [/L:LogDrive:\Path\Log]
Examples:
C:\Users\sudhakar>backup c:\foit\qi.txt c: /s /a /f:4
Backup of qi.txt has been made in c:
35. CHKDSK: Chkdsk is a utility that checks the computer's hard
drive status for any cross-linked or any additional errors with
the hard drive.
Syntax:
CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C]
[/L[:size]]
Examples:
1. C:\Users\sudhakar>chkdsk /v /i /c
The type of the file system is NTFS.
WARNING! F parameter not specified.
Running CHKDSK in read-only mode.
WARNING! I parameter specified.
WARNING! C parameter specified.
Your drive may still be corrupt even after running CHKDSK.
CHKDSK is verifying files (stage 1 of 3)...
0 percent complete. (19969 of 437248 file records processed)
2. C:\Users\sudhakar>chkdsk c:
The type of the file system is NTFS.
WARNING! F parameter not specified.
Running CHKDSK in read-only mode.
CHKDSK is verifying files (stage 1 of 3)...
4 percent complete. (193793 of 437248 file records processed
36. COMP: A simple compare that compares two or more files.
Syntax: COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C]
Examples:
C:\Users\sudhakar>comp c:\foit\new.txt c:\foit\new1.txt /n=4 /d
Comparing C:\foit\new.txt and C:\foit\new1.txt...
Compare error at LINE 1
file1 = 107
file2 = 97
Compare error at LINE 1
file1 = 110
file2 = 115
Compare error at LINE 1
file1 = 99
file2 = 97
2. C:\Users\sudhakar>comp c:\foit\new.txt c:\foit\new1.txt /n=4 /a
Comparing C:\foit\new.txt and C:\foit\new1.txt...
Compare error at LINE 1
file1 = k
file2 = a
Compare error at LINE 1
file1 = n
file2 = s
Compare error at LINE 1
file1 = c
file2 = a
3. C:\Users\sudhakar>comp c:\foit\new.txt c:\foit\new1.txt /n=4 /l
Comparing C:\foit\new.txt and C:\foit\new1.txt...
Compare error at LINE 1
file1 = 6B
file2 = 61
Compare error at LINE 1
file1 = 6E
file2 = 73
37. COLOR: The color command enables users running Microsoft
Windows 2000 and Windows XP to change the default color of their
background or text in their MS-DOS window.
Syntax: COLOR [attr]
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each
digit can be any of the below values.
Examples
C:\Users\sudhakar>color 0
Creates a Black background with light bright green text, similar to
many of the FTP, telnet, and old BBS console screens.
38. DATE: The date command can be used to look at the current
date of the computer as well as change the date to an alternate
date.
Syntax
DATE [date]
Type DATE without parameters to display the current date setting
and a prompt for a new one. Press ENTER to keep the same date.
Examples
C:\Users\sudhakar>date
The current date is: Wed 08/28/2013
Enter the new date: (mm-dd-yy)
39. DEL: Del is a command used to delete files from the computer.
Syntax:
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
Examples:
C:\Users\sudhakar>del /p c:\foit\qi.txt
c:\foit\qi.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f c:\foit\qi.txt
c:\foit\qi.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f /a c:\foit\qi.txt
c:\foit\qi.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f /a /s c:\foit\qi.txt
c:\foit\qi.txt, Delete (Y/N)? y
Deleted file - c:\foit\qi.txt
40. DIR: The dir command allows you to see the available files and
directories in current directory. In addition to listing the contents of
a directory, the dir command will also show the last modification
date and time, as well as the file size.
Syntax:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
Examples:
C:\Users\sudhakar>dir c:\foit /a:a /d /o:n /q /s /t:c /x /4
Volume in drive C has no label.
Volume Serial Number is 00CE-8A14
Directory of c:\foit
08/27/2013 11:00 PM 1,061 N.TXT BUILTIN\
Administrators new.txt
08/27/2013 10:54 PM 79 BUILTIN\Administrators
new1.txt
2 File(s) 1,140 bytes
Directory of c:\foit\c
08/28/2013 02:53 AM 0 BUILTIN\Administrators
qit.txt
1 File(s) 0 bytes
Total Files Listed:
3 File(s) 1,140 bytes
0 Dir(s) 63,785,873,408 bytes free
41. DRIVERQUERY: Enables an administrator to display a list of
installed device drivers.
Syntax:
DRIVERQUERY [/S system [/U username [/P [password]]]][/FO format]
[/NH] [/SI] [/V]
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under which the
command should execute.
/P [password] Specify the password for the given user context.
/FO format Specifies the type of output to display.
Valid values to be passed with the switch are "TABLE", "LIST", "CSV".
/NH Specifies that the "Column Header" should not be
displayed. Valid for "TABLE" and "CSV" format only.
/SI Provides information about signed drivers.
/V Displays verbose output. Not valid for signed drivers.
/? Displays this help message.
Examples:
DRIVERQUERY
DRIVERQUERY /FO CSV /SI
DRIVERQUERY /NH
DRIVERQUERY /S ipaddress /U user /V
DRIVERQUERY /S system /U domain\user /P password /FO LIST
42. ERASE: Erase is a command used to remove files from your
computer's hard drive or other writable media.
Syntax:
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
Examples:
C:\Users\sudhakar>erase /p c:\foit\new.txt
c:\foit\new.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f c:\foit\qi.txt
Could Not Find c:\foit\qi.txt
C:\Users\sudhakar>del /p /f c:\foit\new.txt
c:\foit\new.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f /s c:\foit\new.txt
c:\foit\new.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f /s /a c:\foit\new.txt
c:\foit\new.txt, Delete (Y/N)? n
C:\Users\sudhakar>del /p /f /s /a /q c:\foit\new.txt
c:\foit\new.txt, Delete (Y/N)? y
Deleted file - c:\foit\new.tx
43. EXIT: The exit command is used to withdrawal from the
currently running application and the MS-DOS session.
Syntax: EXIT
Examples:
C:\Users\sudhakar>exit
When in another command interpreter, would exit you out of the
new command interpreter into the original.
When entering DOS from Windows, would return you to
Windows.
If in the recovery console, would exit the recovery console and
reboot the computer.
44. FIND: Allows you to search for text within a file. Although MS-
DOS itself is not case sensitive, when typing in the string that you
are looking for with the find command, it is case sensitive.
Additionally, this command is used to find text within a file, not the
actual file itself.
Syntax:
FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]
If a pathname is not specified, FIND searches the text typed at the
prompt or piped from another command.
Examples:
C:\Users\sudhakar>find /v /c /n /i "eg" c:\foit\new1.txt
---------- C:\FOIT\NEW1.TXT: 2
C:\Users\sudhakar>find /v /c /n "eg" c:\foit\new1.txt
---------- C:\FOIT\NEW1.TXT: 2
C:\Users\sudhakar>find /v /c "eg" c:\foit\new1.txt
---------- C:\FOIT\NEW1.TXT: 2
C:\Users\sudhakar>find /v "eg" c:\foit\new1.txt
---------- C:\FOIT\NEW1.TXT
ksjncskjclksclslksl hswfoe
jdfskfslknlsm dkhd
C:\Users\sudhakar>find "eg" c:\foit\new1.txt
---------- C:\FOIT\NEW1.TXT
ajsakcslclsnclsk sfdeg
jsfsyfaknfksjlksvsivmslsi egeg
45. RMDIR: Removes an empty directory in MS-DOS.
Syntax:
RMDIR [drive:]path
RD [drive:]path
Examples:
C:\Users\sudhakar>rmdir c:\foit
The directory is not empty.
C:\Users\sudhakar>rmdir c:\foit\c\d
C:\Users\sudhakar>rmdir c:\foit /s
c:\foit, Are you sure (Y/N)? y
46. SHUTDOWN: Enables a user to shutdown a Windows XP
computer from the command line as well as perform additional
features that are not available through Windows.
Syntax:
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\
computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
No args Display this message (same as -?)
/i Display the graphical user interface (GUI).
This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is
rebooted, restart any registered applications.
/a Abort a system shutdown. This can only be used during
the time-out period.
/p Turn off the local computer with no time-out or warning.
Can be used with /d and /f options.
/h Hibernate the local computer. Can be used with the /f
option.
/e Document the reason for an unexpected shutdown of a
computer.
/m \\computer \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-315360000 (10 years), with a default
of 30. If the timeout period is greater than 0, the /f
parameter is implied.
/c "comment" Comment on the reason for the restart or shutdown.
Maximum of 512 characters allowed.
/f Force running applications to close without forewarning
users. The /f parameter is implied when a value greater
than 0 is specified for the /t parameter.
/d [u] [p]:xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined.
Examples
C:\Users\sudhakar>shutdown -r -c "Rebooting for latest updates."
This would display a Windows System Shutdown window for 30
seconds, warning the user that the computer is going to
shutdown and then restart the computer.
47. SYSTEMINFO: Displays complete system information for
Microsoft Windows XP Professional computers.
Syntax:
systeminfo[.exe] [/s Computer [/u Domain\User [/p Password]]] [/fo
{TABLE|LIST|CSV}] [/nh]
Examples:
C:\Users\sudhakar>systeminfo
Host Name: DE-KTRIKHA1
OS Name: Microsoft Windows 7 Enterprise
OS Version: 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: ZS
Registered Organization: ZS Associates
Product ID: 00392-918-5000002-85504
Original Install Date: 10/29/2010, 4:49:35 AM
System Boot Time: 8/25/2013, 4:26:45 AM
48. TASKLIST: This tool displays a list of currently running
processes on either a local or remote machine.
Syntax:
TASKLIST [/S system [/U username [/P [password]]]] [/M [module]
| /SVC | /V] [/FI filter] [/FO format] [/NH]
Examples:
1. C:\Users\sudhakar>tasklist /v
CamMute.exe 3008 Services 0 536 K
Unk
nown NT AUTHORITY\SYSTEM
0:00:00 N/A
micmute.exe 3032 Services 0 1,076 K
Unk
nown NT AUTHORITY\SYSTEM
0:00:00 N/A
2. C:\Users\sudhakar>tasklist /nh
System Idle Process 0 Services 0 24 K
System 4 Services 0 4,576 K
smss.exe 384 Services 0 52 K
csrss.exe 568 Services 0 1,672 K
3. C:\Users\sudhakar>tasklist /fo table
Image Name PID Session Name Session#
Mem Usage
System Idle Process 0 Services 0 24 K
System 4 Services 0 4,584 K
smss.exe 384 Services 0 52 K
4. C:\Users\sudhakar>tasklist /svc
Image Name PID Services
========================= ========
============
System Idle Process 0 N/A
System 4 N/A
smss.exe 384 N/A
csrss.exe 568 N/A
49. TREE: Allows the user to view a listing of files and folders in an
easy to read listing.
Syntax:
TREE Drive:\ Path /f /a
Examples:
C:\Users\sudhakar>tree c:\Users /a /f
Folder PATH listing
Volume serial number is 00000002 00CE:8A14
C:\USERS
├───Administrator
│ ├───Contacts
│ ├───Desktop
│ ├───Documents
│ │ ├───BlackBerry
│ │ │ └───Backup
│ │ ├───Bluetooth Exchange Folder
│ │ ├───PDF files
│ │ │ ├───AutoSave
│ │ │ └───Forms
│ │ ├───SametimeTranscripts
│ │ └───SavedChats
50. TYPE: Allows the user to see the contents of a file.
Syntax:
Type [drive:][path]filename
Examples:
C:\Users\sudhakar>type c:\new.txt
Allows u to see new.txt if it exists
51. VERIFY: Enables or disables the feature to determine if files
have been written properly.
Syntax:
VERIFY [ON | OFF]
Examples:
C:\Users\sudhakar>verify
VERIFY is off.
C:\Users\sudhakar>verify on
C:\Users\sudhakar>verify
VERIFY is on.
52. XCOPY: Xcopy is a powerful version of the copy command with
additional features; has the capability of moving files, directories,
and even whole drives from one location to another.
Syntax:
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...]
EXAMPLES:
C:\Users\sudhakar>xcopy C:\*.* /a /e /k
It will copy everything located on the c drive to the drive you
are currently on.
C:\Users\sudhakar>xcopy *.* /h hope
It will copy all files in the current directory including any hidden
files into the hope directory.
C:\Users\sudhakar>xcopy c:\temp /e
copies the files, directories, and subdirectories to the directory
you're currently in.