Introduction to Windows Common CMD commands
Windows
Usually we use a windows that is called CMD, most people may almost never encounter the use of CMD, the Linux operating system has the same type of Bash,os x under the terminal. We often call these three things terminal (terminal) or shell.
So what's the effect of these terminal? The simple expression is to use the command line execution instead of the graphical interface of the mouse operation! OK, don't you understand? Let's take a look at the examples below!
This article describes some of the most common operations in life, such as creating new, deleting files and folders, printing a document tree, and shutting down a command line implementation. So how do we open cmd?
Method 0: Find the cmd command prompt inside the Start menu;
Method 1:win+r key to open the run bar, type cmd, enter;
Method 2:shift+ The right mouse button and choose to Open a command prompt here
...
CMD is composed of commands and parameters , each of which corresponds to different implementation effects, while the correct use of multiple parameters can achieve the effect of superposition. Type help in CMD to see a list of cmd available commands , and to see an introduction to the command, a list of parameters, and how to use it using the + command name .
Timed shutdown operation
- About the command: shutdown
- Relevant parameters:/s/t XXX
- Usage Example: shut/s/t 36,001 hours after shutdown
- Note: The shutdown command not only can be used to set the timer shutdown, shutdown command There are many other parameters,/l/r/g/h, etc., can be used for sleep, logoff and restart operation. To learn more about usage, type help shutdown in cmd to query.
Directory Jump
- About commands: CD
- About Parameters: Folder path
- Usage Example: cd/d D:/DEMO=D:+CD Demo
- Description: Toggle the current CMD's working path to the D drive under the demo folder; path the relative path of the available folder can also use the absolute path of the folder on the disk.
Note: The CD command cannot change the directory across the disk drive without the/d parameter, plus/d can be toggled at each location on the hard disk partition.
New Folder
- About the command: Md/mkdir
- Common parameters: New folder name
- Usage Example: mkdir d:\demo
- Description: mkdir d:\demo command can create a new folder called demo under the D packing directory.
Delete Folder action
- About Commands: Rd
- Common parameters: folder location/folder name
- Usage Example: RD Demo
- Description: Delete the demo folder!
Note: Rd cannot delete non-empty folders, so this command is chicken ribs! It's easy to get loaded, but it's a waste of your time (Linux Unix or DOS to delete folders with commands is much easier)
Delete a development file
- Related commands: Del erase
- Common parameters: File path/filename
- Usage Example: Del d:\demo\demo.txt erase D:\demo\demo.txt
- Note: This command will remove the demo.txt from the D-disk demo directory.
View the document tree structure
- About the command: Tree
- Common parameters:/F folder path/file name
- Usage Example: Tree D:\demo
- Description: Tree D:\demo can view the directory hierarchy under the demo directory (do not display separate files), plus the/F parameter to display a single file to the document tree, example diagram ↓
Export command run result into text document
The last one is special, but it is more convenient to use. Sometimes you want to tell the results of the command run to others, you don't want to send plain text, but CMD cannot be copied like a normal text editor. What should I do then?
Scenario: Girlfriend let you put in your computer movie folder in all the movies listed, she wants to pick a favorite you see together, of course, you can give her computer to choose, but also to a point folder so view, then you think of using CMD to solve the problem.
Assuming your computer is in the video directory of the D drive Havefun, you turn on cmd:
- C:\USER\YOURACCOUNT>CD/D D:\HaveFun
- d:\havefun>tree/f Video>c:\users\youraccount\desktop\list.txt
At this point you will find no output, but open the desktop will find a more list.txt, and then you just let your girlfriend in the document tree to find their favorite movie! excited!
We notice that the command run has no results appearing in the cmd dialog because of the turn character , which means that the result of running the command is directed to a specific text document that is exported to a specific directory (the original text will be created).
Enlightenment:
CMD does not have the command to create a new file, then how do we use CMD to create a new blank file?
We can get inspired by the use of >:> used to export a command run result to a specific file that does not exist then create a new file and import the run result.
Idea: The output of any command that does not have an output (that is, blank) is moved to the specified document for the purpose of creating a new file.
Example:
Typenul>d:\demo\newfile.txt
-----This command creates a new blank NewFile.txt file in the D-disk demo directory
Cd>d:\demo\newfile.mp4
Cd.>d:\demo\newfile.mp4
-----The above two commands to create a new blank Newfile.mp4 file in the D-disk demo directory
So in theory, as long as the output is a blank command, you can use > 's steering function to create a new blank file!
For a programmer, an operating system is not easy to take into account the command line terminal ease of use, learn to use the command line terminal is also a necessary accomplishment of the programmer.
In peacetime life really do not need to use these obscure things, but once learned, will become you installed force and improve the quality of life a big weapon!
The use of CMD is far more than that, and we can also use:
Ping www.baidu.com
-----ping command to send a packet to Baidu, to learn about the network connection situation
Ipconfig
-----Get native Detailed network configuration information
......
If you are interested, then go and explore!
Can be Baidu cmd command quick check Manual to get command of online learning, or use the CMD bring help to learn.
Introduction to Windows Common CMD commands