Getting started with BAT scripting-Common commands
Common commands in command window
1. Cd command
Cd / / displays the current directory cd.. / / exit to the previous directory cd / d D: / / enter the directory where the last D disk is located, cd / d d:\ / / enter the root directory of D disk cd / d D:\ test / / enter the test directory under D disk
2. Md: create a new folder
Md D:\ test / / create a test folder under disk D md test1 test2 / / create test1 and test2 folders under the current directory
3. Dir: displays the contents of the directory
Dir / / displays folders and files in the current directory dir / b / / displays only the file names of the current directory dir / p / / pagination shows the contents of the files in the current directory dir / ad / / shows the folder in the current directory dir / a murd / / shows the current directory The file in the record dir C:\ windows / / display the contents under disk c windows dir test.txt / / display the current directory to find that test.txt information dir / S / / Recursive display the contents of the current directory dir test* / / shows the files and folders under the current directory that begin with test The dir / AH / OS / / value shows hidden files and directories in the current directory. And sort by file size from small to large
4. Rd: delete a directory
Rd test / / Delete the empty test folder under the current directory rd / s / Q d:\ test / / use quiet mode to delete d:\ test (in addition to the directory itself, delete all subdirectories and files under the oyster)
5. Ren: rename a file or directory
Ren test.txt sample.bat / / rename the test.txt file in the current directory to sample.bat ren c:\ test test02 / / rename the test file on disk c to test02
6. Tree: displays the directory structure
Tree D:\ test / / displays the directory structure of the d disk test