Windows common commands (file manipulation section)
Switch drive letter: root directory: d: superior directory: cd.. Relative path: cd test absolute path: cd c:\ test View current directory: echo% cd% or cd switch drive letter: cd / d e:\ test environment variable: view: echo% path% or path clear current: path View files / folders: no hidden files: dir hidden files: dir / a sort: dir / on attributes Operation: + add attributes-clear attributes r read-write s system h hide # differences between system files and ordinary files: system files do not allow users to modify properties directly Ordinary files allow users to modify attributes to hide files: attrib + h a.txt read-only file: attrib + r a.txt read-write: attrib + an a.txt display file: attrib-h a.txt recursive operation: attrib / s + h * .txt create file: empty file: echo. > test.txt with content: echo abc > test.txt create folder: single folder: md test multiple folders: md test1 test2 multi-level directory: md test1\ test2\ test3... Copy file: single: copy / y a.txt a.txt.back multiple: copy / y * .txt * .txt.back merge: copy a.txt+b.txt c.txtcopy * .txt cmb.txt enter multiple lines of text to file: copy con test.txt # press enter to end with ctl+z enter copy folder: no hidden file: xcopy / y test1 test2 hidden file: xcopy / y / h test1 test2 contains empty file Folder: xcopy / y / e / h test1 test2 delete files: single: del / f / Q a.txt multiple: del / f / Q * .txt recursive: del / s / f / Q * .txt delete folder: rd / s / Q test renamed files / folders: single: move an aa multiple: ren * .txt * .bat mobile files / folders: move / y test1 test2 Find / statistics file: display line number: find / n "str" test.txt count lines: find / c "str" test.txt view file content: findstr. " Test.txt compare file differences: two files: fc / n a.txt b.txt multiple files: fc / n *. Txt b.txt view file contents: show all: type test.txt paging display: more test.txt # space shows next page compression, decompression: prerequisite: install winrar software compression, add: rar a test.zip file / folder extract: rar e test.zip path