Assignment 2
Assignment 2
1. SYNTAX:
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path]
filename] [/S [/D]]
Examples:
1. C:\Users\sudhakar>attrib -r
2. C:\Users\sudhakar >attrib -a
3. C:\Users\sudhakar>attrib -s
4. C:\Users\sudhakar>attrib -a
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
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.
C:\Users\sudhakar>prompt
Syntax
Options:
Examples
Syntax :
Note that you cannot specify a new drive or path for your
destination.
Examples
EXAMPLE
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
Examples
C:\Users\sudhakar>mkdir c:\c
C:\Users\sudhakar>mkdir c:\c\d
C:\Users\sudhakar>md cr
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
Replacing C:\new1.txt
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
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
2. C:\Users\sudhakar>cmd /k set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\sudhakar\AppData\Roaming
3. C:\Users\sudhakar>cmd /s call
4. C:\Users\sudhakar>cmd /q call
5. C:\Users\sudhakar>cmd /d assoc
6. C:\Users\sudhakar>cmd /a start
Syntax:
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination]
[/A | /B]] [/V] [/Y | /-Y]
Examples:
1 file(s) copied.
1 file(s) copied.
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
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
Examples:
to create a batch program named MACINIT.BAT that includes all Doskey
macros
doskey tx=cd\temp$tdir/w $*
The macro first creates a new directory and then changes to it from
the current directory.
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:
Examples:
C:\Users\sudhakar>echo
ECHO is on.
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:
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 /?
4. C:\Users\sudhakar>edit /b tex.txt
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:
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
00000001: 4F 6F
00000008: 64 0D
00000009: 65 0A
***** text.txt
hOw r u dear??
***** TEX.TXT
How r u
*****
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
5. C:\Users\sudhakar>fc /N text.txt tex.txt
***** text.txt
1: hOw r u dear??
***** TEX.TXT
1: how r u
*****
***** text.txt
hOw r u dear??
***** TEX.TXT
how r u
*****
***** 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
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
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
Syntax: VER
Examples:
C:\Users\sudhakar>ver
Microsoft Windows [Version 6.1.7601]
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 file(s) moved.
1 file(s) moved.
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 ;
Examples:
C:\Users\sudhakar>path
Syntax:
Examples:
C:\Users\sudhakar>PUSHD
The current directory ie C:\Users\sudhakar would be stored.
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:
31. HELP: Help is used to access the information and help file from
a MS-DOS prompt.
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
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:
2. C:\Users\sudhakar>dir|more
Directory of C:\Users\sudhakar
Syntax:
BACKUP [Source:\Path\Filename] [Target:] [/s] [/m] [/a] [/d:date]
[/t:time] [/f:size] [/L:LogDrive:\Path\Log]
Examples:
Syntax:
CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C]
[/L[:size]]
Examples:
1. C:\Users\sudhakar>chkdsk /v /i /c
2. C:\Users\sudhakar>chkdsk c:
Examples:
C:\Users\sudhakar>comp c:\foit\new.txt c:\foit\new1.txt /n=4 /d
file1 = 107
file2 = 97
file1 = 110
file2 = 115
file2 = 97
file1 = k
file2 = a
file1 = n
file2 = s
file1 = c
file2 = a
file1 = 6B
file2 = 61
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.
Examples
C:\Users\sudhakar>color 0
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]
Examples
C:\Users\sudhakar>date
Examples:
C:\Users\sudhakar>del /p c:\foit\qi.txt
C:\Users\sudhakar>del /p /f c:\foit\qi.txt
C:\Users\sudhakar>del /p /f /a c:\foit\qi.txt
C:\Users\sudhakar>del /p /f /a /s 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:
Examples:
Directory of c:\foit
Directory of c:\foit\c
1 File(s) 0 bytes
Parameter List:
Examples:
DRIVERQUERY
DRIVERQUERY /FO CSV /SI
DRIVERQUERY /NH
DRIVERQUERY /S ipaddress /U user /V
DRIVERQUERY /S system /U domain\user /P password /FO LIST
Syntax:
Examples:
C:\Users\sudhakar>erase /p c:\foit\new.txt
C:\Users\sudhakar>del /p /f c:\foit\qi.txt
C:\Users\sudhakar>del /p /f c:\foit\new.txt
C:\Users\sudhakar>del /p /f /s c:\foit\new.txt
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
Syntax: EXIT
Examples:
C:\Users\sudhakar>exit
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:
---------- C:\FOIT\NEW1.TXT: 2
---------- C:\FOIT\NEW1.TXT: 2
---------- C:\FOIT\NEW1.TXT: 2
---------- C:\FOIT\NEW1.TXT
ksjncskjclksclslksl hswfoe
jdfskfslknlsm dkhd
---------- C:\FOIT\NEW1.TXT
ajsakcslclsnclsk sfdeg
jsfsyfaknfksjlksvsivmslsi egeg
RMDIR [drive:]path
RD [drive:]path
Examples:
C:\Users\sudhakar>rmdir c:\foit
C:\Users\sudhakar>rmdir c:\foit\c\d
C:\Users\sudhakar>rmdir c:\foit /s
Syntax:
Examples
C:\Users\sudhakar>shutdown -r -c "Rebooting for latest updates."
Syntax:
Examples:
C:\Users\sudhakar>systeminfo
Registered Owner: ZS
Syntax:
Examples:
1. C:\Users\sudhakar>tasklist /v
nown NT AUTHORITY\SYSTEM
0:00:00 N/A
nown NT AUTHORITY\SYSTEM
0:00:00 N/A
2. C:\Users\sudhakar>tasklist /nh
4. C:\Users\sudhakar>tasklist /svc
========================= ========
============
System 4 N/A
49. TREE: Allows the user to view a listing of files and folders in an
easy to read listing.
Syntax:
Examples:
C:\Users\sudhakar>tree c:\Users /a /f
C:\USERS
├───Administrator
│ ├───Contacts
│ ├───Desktop
│ ├───Documents
│ │ ├───BlackBerry
│ │ │ └───Backup
│ │ ├───PDF files
│ │ │ ├───AutoSave
│ │ │ └───Forms
│ │ ├───SametimeTranscripts
│ │ └───SavedChats
Type [drive:][path]filename
Examples:
C:\Users\sudhakar>type c:\new.txt
Syntax:
Examples:
C:\Users\sudhakar>verify
VERIFY is off.
C:\Users\sudhakar>verify on
C:\Users\sudhakar>verify
VERIFY is on.
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 all files in the current directory including any hidden
files into the hope directory.
C:\Users\sudhakar>xcopy c:\temp /e