cmd


root drive ကိုျပန္သြားလိုလွ်င္-
cd\

ေပ်ာက္ေနေသာဖိုဒါမ်ား ဖိုင္မ်ားသီးသန္ ့ၾကည့္ရန္ -
dir/ah    ( c အတြင္းၾကည့္လွ်င္ c , d အတြင္းၾကည့္လိုလွ်င္ d )

hidden folder မ်ားကိုသာ ၾကည့္လိုလွ်င္-
dir /ahd /s  (d= folder)
.
ေပ်ာက္ေနေသာဖိုဒါမ်ားႏွင့္ ရွိရင္းဖိုဒါမ်ား အကုန္ေရာၾကည့္ရန္ -
dir/a  
 .
ေပ်ာက္ေနေသာ ဖိုဒါတစ္ခုခ်င္းအား ျပန္ေဖာ္လိုလွ်င္ -
attrib –r –a –s –h example
.
ဖိုဒါ တစ္ခုအား ေဖ်ာက္လိုလွ်င္- 
attrib +r +a +s +h "example"
.
ေပ်ာက္ေနေသာ ဖိုဒါ အားလံုး ျပန္ေဖာ္လိုလွ်င္ -
attrib –s –h /s /d *.*
 .
ဖိုင္ဖ်က္လိုလွ်င္ -
del example.mp3
.
ဖိုဒါဖ်က္လိုလွ်င္ -
rd example /s     ( ဖိုဒါအတြင္းရွိ ဆပ္ဖိုဒါ,ဖိုင္ မ်ားအကုန္ဖ်က္မည္)
.
ဖိုဒါေကာ္ပီကူးလိုလွ်င္ -
xcopy example D: /s   (ဖိုဒါ အတြင္းရွိ ဆပ္ဖိုဒါ,ဖိုင္မ်ား အကုန္ D သို ့ေရာက္မည္။)
.
ဖိုဒါတစ္ခုအား ခ်န္ျပီး အျခားဖိုဒါမ်ားကို ရွာခ်င္လွ်င္
dir /a:-d /ah /s /b |  findstr /v /i $RECYCLE.BIN
 .
ဖိုဒါ နစ္ခုအား ခ်န္ျပီး အျခားဖိုဒါမ်ားကို ရွာ
dir/ah /s /b | findstr /v /i $RECYCLE.BIN | findstr /v /i "System Volume Information"
.
xcopy examplefolder /c /s D:\destinationfolder 
( /c = ေကာ္ပီကူးေနစဥ္အတြင္း မကူးယူႏိုင္ေသာ ဖိုိင္မ်ား၇ွိပါက ေက်ာ္သြားျပီး က်န္ဖိုင္မ်ားကို
ဆက္ကူးသြားမည္။)
.
နာမည္သာသိေသာ ဖိုဒါ တစ္ခုကို ရွာလိုလွ်င္-
dir example /s 
 
ဖိုင္အမ်ိဳးစားတစ္ခုတည္းကိုသာ ရွာလိုလွွ်င္- 
dir *.mp3 /s  ( mp3 ဖိုင္အားလံုးကို ရွာေပးမည္။)
 .
တစ္ခုေသာဖိုင္အမ်ိဳးအစားအားလံုးကို ဖ်က္လိုလွ်င္- 
del *.lnk /s ( .lnk ဖိုင္အမ်ိဳးစား အားလံုးပ်က္မည္။) 
 .
ထပ္ဆင့္ ဖိုဒါမ်ား အတြင္းထိမက်န္ ေပ်ာက္ေနေသာ ဖိုင္အားလံုးကိုဖ်က္လိုလွ်င္ -
del * /ah /s
.
yes or no မေမးေစရန္ 
/Q Quiet mode, do not ask if ok to delete on global wildcard 
.
/P Prompts for confirmation before deleting each file.
.
တင္း်က္ရန္
/F Force deleting of read-only files.
.

/S Delete specified files from all subdirectories. 
.
/A Selects files to delete based on attributes 
 

.

FINDSTR

Search for strings in files.
Syntax
      FINDSTR string(s) [pathname(s)]
         [/R] [/C:"string"] [/G:StringsFile] [/F:file] [/D:DirList]
            [/A:color] [/OFF[LINE]] [options]

Key
   string      Text to search for.
   pathname(s) The file(s) to search. 
   /C:string   Use string as a literal search string (may include spaces).
   /R          Use string as a regular expression.
   /G:StringsFile  Get search string from a file (/ stands for console).
   /F:file     Get a list of pathname(s) from a file (/ stands for console).
   /d:dirlist  Search a comma-delimited list of directories.
   /A:color    Display filenames in colour (2 hex digits)

options can be any combination of the following switches:

   /I   Case-insensitive search.
   /S   Search subfolders.
   /P   Skip any file that contains non-printable characters
   /OFF[LINE] Do not skip files with the OffLine attribute set.
   /L   Use search string(s) literally.
   /B   Match pattern if at the Beginning of a line.
   /E   Match pattern if at the END of a line.
   /X   Print lines that match exactly.
   /V   Print only lines that do NOT contain a match.
   /N   Print the line number before each line that matches.
   /M   Print only the filename if a file contains a match.
   /O   Print character offset before each matching line.

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[:]attribute 

   /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:S  System file    /A:-S  NOT System file
   /A:I  Not content indexed Files  /A:-I  NOT content indexed
   /A:L  Reparse Point  /A:-L  NOT Reparse Point (symbolic link)

   /A:X  No scrub file  /A:-X  Scrub file    (Windows 8+)
   /A:V  Integrity      /A:-V  NOT Integrity (Windows 8+)

   /A    Show all files
   Several attributes can be combined e.g. /A:HD-R

   [sorted]   Sorted by /O[:]sortorder

   /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 can 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 can 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 - can display the filename in upper or lower case - this can 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 "/"
Normally DIR /b will return just the filename, however when displaying subfolders with DIR /b /s the command will return a full pathname.
All file sizes are shown in bytes.
Examples
List the contents of c:\demo including ALL files:
dir /a c:\demo\
List the contents of c:\demo displaying only the filenames:
dir /b c:\demo\
List all the Reparse Points (symbolic links) in the current users profile:
dir %USERPROFILE% /a:i
List the contents of c:\demo with the full path of each file (source)
for %%A in ("c:\demo\*") do echo %%~fA
List the contents of c:\demo, without the header/footer details:
FOR /f "tokens=*" %%G IN ('dir c:\demo\*.* ^| find "/"') DO echo %%G
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

Related

WHERE - Locate and display files in a directory tree.
XCOPY /L - List files without copying.
ROBOCOPY /L - List files with specific properties
DIRUSE - show size of multiple subfolders. (Resource Kit)
Freedisk.exe - check free disk space. (Win 2K ResKit)
Powershell: Get-ChildItem - Get child items (contents of a folder or registry key) dir / ls / gci
You can also get File Sizes and Date/Time from Batch Parameters
Use DIR to display drive status - disk missing / ready / empty
Equivalent bash command (Linux): ls - List information about file(s)
Equivalent Powershell: Get-ChildItem
.
http://ss64.com/nt/dir.html

0 Comments:

Post a Comment



Newer Post Older Post Home

Latest Posts