Errorlevels
returned by DevCon.exe:
0 = success.
1 - restart is required.
2 = failure.
3 = syntax error.
“I've learned that people will forget what you said, people will forget what you did, but people
will never forget how you made them feel” ~ Maya Angelou
DIR
Display a list of files and subfolders
Syntax
DIR [ pathname(s)] [ display_format] [ file_attributes] [ sorted]
[ time] [ options]
Key
[ pathname] The drive, folder, and/or files to display,
this can include wildcards:
* Match any characters
? Match any ONE character
[ display_format]
/P Pause after each screen of data.
/W Wide List format, sorted horizontally.
/D Wide List format, sorted by vertical column.
[ file_attributes] /A:
/A:D Folder /A:-D NOT Folder
/A:R Read-only /A:-R NOT Read-only
/A:H Hidden /A:-H NOT Hidden
/A:A Archive /A:-A NOT Archive
/A Show all files
Several attributes may be combined e.g. /A:HD-R
[s orted] Sorted by /O:
/O:N Name /O:-N Name
/O:S file Size /O:-S file Size
/O:E file Extension /O:-E file Extension
/O:D Date & time /O:-D Date & time
/O:G Group folders first /O:-G Group folders last
several attributes may be combined e.g. /O:GEN
[ time] /T: the time field to display & use for sorting
/T:C Creation
/T:A Last Access
/T:W Last Written (default)
[ options]
/S include all subfolders.
/R Display alternate data streams. (Vista and above)
/B Bare format (no heading, file sizes or summary).
/L use Lowercase.
/Q Display the owner of the file.
/N long list format where filenames are on the far right.
/X As for /N but with the short filenames included.
/C Include thousand separator in file sizes.
/-C Don’t include thousand separator in file sizes.
/4 Display four-digit years
The switches above may be preset by adding them to an environment variable called DIRCMD.
For example:
SET DIRCMD=/O:N /S
Override any preset DIRCMD switches by prefixing the switch with -
For example:
DIR *.* /-S
Upper and Lower Case filenames:
Filenames longer than 8 characters - will always display the filename with mixed case as
entered.
Filenames shorter than 8 characters - may display the filename in upper or lower case - this may
vary from one client to another (registry setting)
To obtain a bare DIR format (no heading or footer info) but retain all the details, pipe the output
of DIR into FIND, this assumes that your date separator is
/
DIR c:\temp\*.* | FIND "/"
FOR /f "tokens=*" %%G IN ('dir c:\temp\*.* ^| find "/"') DO echo %%G
All file sizes are shown in
bytes
.
Normally
DIR /b
will return just the filename, however when displaying subfolders with
DIR /b
/s
the command will return a
full pathname
.
On Windows Vista and later, a list of alternate data streams can be obtained using
DIR /R
, on
earlier operating systems, the SysInternals utility
streams
can be used instead.
DIR is an
internal
command.
“There it was, hidden in alphabetical order” ~ Rita Holt
DIRUSE
(
2K Resource Kit / XP Support Tools
)
Display disk usage
Syntax
DIRUSE [ options] Folders...
Options
/M Display in Mb
/K Display in Kb
/B Display in bytes (default)
/, Use thousand separator when displaying sizes.
/Q:#
Quota limit, mark folders that exceed the size (#) with a
"!".
set %errorlevel% to ONE if any folders are found that
exceed the specified size
/* Report on one level of subfolders (top-level folders)
/D Display only folders that exceed specified sizes.
/S Include detail of every subfolder in the output
/O Don’t check subfolders for quota overflow.
/V Display progress report for every subfolder
/C Use Compressed size instead of apparent size.
/L Output overflows to logfile .\DIRUSE.LOG.
/A generate an alert if quota is exceeded
(requires the Alerter service)
Note: the '-' symbol can be used in place of the '/' symbol.
Example
C:\> DIRUSE /M /q:1.5 /* e:\users
“Work is achieved by those employees who have not yet reached their level of incompetence” ~
Laurence J. Peter (The Peter Principle)
DiskPart (Windows 7)
Disk Administration, Partition a disk. This page documents the Windows 7/2008 version of
Diskpart, an earlier version of Diskpart is supplied in the 2003 Resource kit with a reduced set of
options.
Syntax
DISKPART
“Divide et impera” ~ Latin saying (Divide and conquer)
DOSKEY.exe
Recall and edit commands at the DOS prompt, and create macros. You cannot run a Doskey
macro from a batch file.
Syntax
DOSKEY [ options] [ macroname=[ text]]
Key
macroname : A short name for the macro.
text : The commands you want to recall.
options : for working with macros...
/MACROFILE= filename Specify a file of macros to install
/MACROS Display all Doskey macros
/EXENAME= exename Specify an executable other than cmd.exe
/MACROS: exename Display all Doskey macros for the given
executable
/MACROS:ALL Display all Doskey macros for all executables
ALT+F10 Clear macro definitions
options : for working with the Command Buffer...
/HISTORY : Display all commands stored in memory.
/LISTSIZE= size : Limit the number of commands remembered by the
buffer.
/REINSTALL : Install a new copy of Doskey (clears the
buffer).
In normal use the command line is always in overwrite mode, DOSKEY
can be used to
change this to Insert, the insert key will always toggle from one to
the other
/INSERT : By default new text you type at the command line
will be inserted in old text
/OVERSTRIKE : By default new text you type at the command line
will overwrite old
In addition to the above, DOSKEY is loaded into memory for every cmd session so you can
use
Keyboard shortcuts
at the command line
The size of the command history can be set from Control Panel, Console or from the properties
of any cmd shortcut. Clear all history with DOSKEY /REINSTALL
Chia sẻ với bạn bè của bạn: |