The command CD\ takes you to the top of the directory tree.
If you need to go to a specific folder from this drive run the command "CD Folder." The subfolders must be separated by a backslash character: "\."
When you need to go one folder up, use the "cd.." command.
To access another drive, type the drive's letter, followed by ":". For instance, if you wanted to change the drive from "C:" to "D:", you should type "d:" and then press Enter on your keyboard.(不要在前面加cd)
To change the drive and the directory at the same time, use the cd command, followed by the "/d" switch. The "/d" parameter is used to change the current drive to a specific folder from another disk volume.
For instance, if you are now on the "D:" drive and you want to go back to the Windows folder from the"C:" drive, you should type "cd /d C:\Windows" and press Enter on your keyboard, like in the following screenshot.
You can make a new folder using the MKDIR (Make Directory) or the MD command. The syntax of these commands is "MKDIR Folder" or "MD Folder."
NOTE: Do not forget that all these commands depend on the current location in the Command Prompt. For instance, if you are on the "C:" drive and type "MKDIR test," the new folder is created in the root of the "C:" drive.
Another way to create a folder that does not involve being in the desired folder is to type the complete path of the new folder. For example, if you are working on the "D:" drive and you want to create a new folder in "C:," called other_stuff, type "mkdir c:\other_stuff" and then press Enter.
When you need to create a folder with subfolders at the same time, you can use the "MKDIR Folder\Subfolder"command. For instance, if we type "mkdir Digital_Citizen_Tests\Beta\Test1" three folders are created: Digital_Citizen_Tests, Beta and Test1, in a tree-like structure.
To rename files and folders, you need to use the REN (Rename) command. To rename folders, type "ren Folder NewFolderName." For example, if we wanted to rename the Digital_Citizen_Tests folder to Digital_Citizen_Final_Tests, we should run "ren Digital_Citizen_Tests Digital_Citizen_Final_Tests" and press Enter.
To rename a file, use the same command, like this: "ren filename.extension newname.extension". For instance, to rename the Digital_Citizen_Picture1.bmp file to Image0.bmp, we have to run the command "ren Digital_Citizen_Image1.bmp Image0.bmp" command.
The Copy command allows you to copy files from one location to another. To use this command, type "copy location\filename.extension newlocation\newname.extension"
To copy a folder and its content from a location to another, use the XCOPY command followed by the "/s /i"operators. Let's assume that we need to copy a folder from "D:\Digital_Citizen" to "C:\Backup_Digital_Citizen." To do that, we have to run the command "xcopy /s /i d:\Digital_Citizen c:\Backup_Digital_Citizen." The "/s" parameter ensures that all the directories and subdirectories are going to be copied, except the ones that are empty. The "/i" parameter creates a new directory if the destination folder does not exist and copies all the files in it.
The DEL (Delete) is used to delete files from the folders you have created. To delete all the files from a folder, you can run the command "del folder." For instance, from the directory, Digital_Citizen found on the "D:" drive if we want to delete all the files from the Digital_Citizen_Tests folder, type the command "del Digital_Citizen_Tests." You need to confirm the delete process by typing the letter "y" from Yes, and then press Enter.
NOTE: To also delete hidden files from the folder, you must add the "/h" parameter. Also, note that the DELcommand does not work for deleting folders - for that, you have to use the RD command
If you need to delete a single file, use the DEL command followed by that file's name. For instance, to delete the file Digital_Citizen_Notes.txt from "D:\Digital_Citizen," we should run the command "del Digital_Citizen_Notes.txt."
Here is a list of useful DEL combinations that are worth mentioning:
The DEL command cannot be used to delete folders. Therefore we must use another command to remove any empty folder: RD (Remove Directory). We have previously deleted all the files from the Digital_Citizen_Testsfolder. It is now time to delete the directory too, by typing "RD Digital_Citizen_Tests."
To run a program from the Command Prompt, you need only to navigate to the folder that contains the executable and type the program's name. For example, if you want to launch Paint using Command Prompt, go to "C:\Windows\System32", where its executable is: mspaint.exe. Let's see how this operation is done if you were in "D:\Digital_Citizen." First of all, change the working directory to the application's folder by typing "cd /d c:\windows\System32\". Then write mspaint.exe or mspaint and press Enter.
To access help in the Command Prompt, you have to type the help command and then press Enter.
If a particular command interests you, type help followed by the name of that command. Another way to do the same thing is to type the command's name followed by the "/?" parameter. To test it, use "help cd" or "cd/?" to display information about the cd command.
来自
CD + 某个文件的前几个字符然后按Tab会自动补全文件名
dir -al/*显示所在目录下的所有文件,包括隐藏的文件*/
echo " # cartwheeling-kitten" >> README.md/*create a file named README.md and write content"cartwheeling-kitten" in it. */
cat README.md /*show content of file named README.md*/
touch .gitignore /*create a blank .gitignore file.*/
notepad .gitignore /*using notepad to open .gitignore*/
git add --all/*add all files to the local repository*/
git remote add origin http://github.com/Li-YangZhong/cartwheeling-kitten /*link remote repository to local repository*/
git push -u origin master /*send code from local repository to remote repository*/