Divyanshu Joshi Dos

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

1.

cls Command
Clears the screen.

CLS
2.ren Command
Renames a file or files.

RENAME [drive:][path]filename1 filename2.


REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your
destination file.

C:\Users\Lab1\Desktop>

3.Find Command

Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:]


[path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the
string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the


prompt
or piped from another command.

4.cd Command

Displays the name of or changes the current directory.


CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]

.. Specifies that you want to change to the parent


directory.

Type CD drive: to display the current directory in the


specified drive.
Type CD without parameters to display the current drive and
directory.

Use the /D switch to change current drive in addition to


changing current
directory for a drive.

If Command Extensions are enabled CHDIR changes as


follows:
The current directory string is converted to use the same
case as
the on disk names. So CD C:\TEMP would actually set the
current
directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is


possible to
CD into a subdirectory name that contains a space without
surrounding
the name with quotes. For example:

cd \winnt\profiles\username\programs\start menu

is the same as:

cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were


disabled.
5.copy Command
Copies one or more files to another location.

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A |
/B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]

source Specifies the file or files to be copied.


/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the
new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a
file with a
non-8dot3 name.
/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.
/Z Copies networked files in restartable mode.
/L If the source is a symbolic link, copy the link to the
target
instead of the actual file the source link points to.

The switch /Y may be preset in the COPYCMD environment


variable.
This may be overridden with /-Y on the command line.
Default is
to prompt on overwrites unless COPY command is being
executed from
within a batch script.

To append files, specify a single file for destination, but


multiple files
for source (using wildcards or file1+file2+file3 format).

6.type command
Displays the contents of a text file or files.

TYPE [drive:][path]filename

7.assoc Command

Displays or modifies file extension associations

ASSOC [.ext[=[fileType]]]

.ext Specifies the file extension to associate the file type


with
fileType Specifies the file type to associate with the file
extension

Type ASSOC without parameters to display the current file


associations.
If ASSOC is invoked with just a file extension, it displays the
current
file association for that file extension. Specify nothing for the
file
type and the command will delete the association for the file
extension.

8.copy con Command


Provides help information for Windows commands.

HELP [command]

command - displays help information on that command.

9.attrib Command
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
[drive:][path][filename] [/S [/D] [/L]]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
I Not content indexed file attribute.
X No scrub file attribute.
V Integrity attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Link

10.systeminfo Command
SYSTEMINFO [/S system [/U username [/P [password]]]] [/FO
format] [/NH]

Description:
This tool displays operating system configuration
information for
a local or remote machine, including service pack levels.

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] Specifies the password for the given


user context. Prompts for input if omitted.

/FO format Specifies the format in which the


output
is to be displayed.
Valid values: "TABLE", "LIST", "CSV".

/NH Specifies that the "Column Header" should


not be displayed in the output.
Valid only for "TABLE" and "CSV" formats.

/? Displays this help message.

Examples:
SYSTEMINFO
SYSTEMINFO /?
SYSTEMINFO /S system
SYSTEMINFO /S system /U user
SYSTEMINFO /S system /U domain\user /P password /FO
TABLE
SYSTEMINFO /S system /FO LIST
SYSTEMINFO /S system /FO CSV /NH
11.format Command
Formats a disk for use with Windows.

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L] [/A:size]


[/C] [/I:state] [
/X] [/P:passes] [/S:state]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors]
[/P:passes]
FORMAT volume [/V:label] [/Q] [/P:passes]
FORMAT volume [/Q]

volume Specifies the drive letter (followed by a colon),


mount point, or volume name.
/FS:filesystem Specifies the type of the file system (FAT,
FAT32, exFAT,
NTFS, UDF, ReFS).
/V:label Specifies the volume label.
/Q Performs a quick format. Note that this switch
overrides /P.
/C NTFS only: Files created on the new volume will
be compressed
by default.
/X Forces the volume to dismount first if necessary.
All opened
handles to the volume would no longer be valid.
/R:revision UDF only: Forces the format to a specific UDF
version
(1.02, 1.50, 2.00, 2.01, 2.50). The default
revision is 2.01.
/D UDF 2.50 only: Metadata will be duplicated.
/L NTFS Only: Use large size file records.
By default, the volume will be formatted with small
size file
records.
/A:size Overrides the default allocation unit size.
Default settings
are strongly recommended for general use.
ReFS supports 64K.
NTFS supports 512, 1024, 2048, 4096, 8192, 16K,
32K, 64K.
FAT supports 512, 1024, 2048, 4096, 8192, 16K,
32K, 64K,
(128K, 256K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16K,
32K, 64K,
(128K, 256K for sector size > 512 bytes).
exFAT supports 512, 1024, 2048, 4096, 8192, 16K,
32K, 64K,
128K, 256K, 512K, 1M, 2M, 4M, 8M, 16M, 32M.

Note that the FAT and FAT32 files systems impose


the
following restrictions on the number of clusters on
a volume:

FAT: Number of clusters <= 65526


FAT32: 65526 < Number of clusters < 4177918

Format will immediately stop processing if it


decides that
the above requirements cannot be met using the
specified
cluster size.

NTFS compression is not supported for allocation


unit sizes
above 4096.
/F:size Specifies the size of the floppy disk to format
(1.44)
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/P:count Zero every sector on the volume. After that,
the volume
will be overwritten "count" times using a different
random number each time. If "count" is zero, no
additional
overwrites are made after zeroing every sector.
This switch
is ignored when /Q is specified.
/S:state Specifies support for short filenames (enable,
disable)
Short names are disabled by default
/I:state ReFS only: Specifies whether integrity should be
enabled on
the new volume. "state" is either "enable" or
"disable"
Integrity is enabled on storage that supports data
redundancy
by default.

12.ver Command
Displays the Windows version.

VER

13.time Command
Displays or sets the system time.

TIME [/T | time]

Type TIME with no parameters to display the current time


setting and a prompt
for a new one. Press ENTER to keep the same time.

If Command Extensions are enabled the TIME command


supports
the /T switch which tells the command to just output the
current time, without prompting for a new time.

14.vol Command
Displays the disk volume label and serial number, if they
exist.

VOL [drive:]

15.Dir Command

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D]


[/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W]
[/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files I Not content indexed files
L Reparse Points - Prefix meaning not
/B Uses bare format (no heading information or
summary).
/C Display the thousand separator in file sizes. This is
the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far
right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest
first)
E By extension (alphabetic) D By date/time (oldest
first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/R Display alternate data streams of the file.
/S Displays files in specified directory and all
subdirectories.
/T Controls which time field displayed or used for
sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-
8dot3 file
names. The format is that of /N with the short name
inserted
before the long name. If no short name is present,
blanks are
displayed in its place.
/4 Displays four-digit years
Switches may be preset in the DIRCMD environment variable.
Override
preset switches by prefixing any switch with - (hyphen)--for
example, /-W.

You might also like