Before your cursor there is the so-called prompt. It tells you what folder you are currently in. It always ends with a ">" (unless specifically changed).
After the prompt, you can type your commands and their arguments.
The output will be displayed below this line.
In this example, we are in the folder "C:\Users\User". The command is "echo hello", which returns the text "hello".
One of the most basic things is to navigate in the file system. This is like clicking around in Windows Explorer.
I have prepared the following folder structure (folders are separated by backslashes.):
C:\tutorial
└───folder
├───subfolder
│ └───subsubfolder
├───subfolder2
└───subfolder3
This means that in C:\ there is a folder called "tutorial". In that folder, there is a folder called "folder". In that folder there are 3 subfolders. "subfolder", "subfolder2" and "subfolder3". Additionally, in "subfolder", there is a folder called "subsubfolder".
Lets navigate from C:\Users\User\ to C:\tutorial\.
We also use "directory" as a word for folder.
To change our current directory, we use the "cd" command (stands for change directory).
CD has the following syntax: cd <path>
In our case, the path is "C:\tutorial".
So we execute "cd C:\tutorial".
As you can see, the prompt changed to "C:\tutorial". This means we have successfully changed to that folder.
If you try to navigate to a folder that doesn't exist, you will get the following error:
As you can see, it says "Cannot find path 'C:\error' because it does not exist".
We can also navigate into a folder, that is within our current folder, without specifying the entire path. This works by simply naming the folder we want to go into. Like this:
Since "folder" exists in "tutorial", it automatically goes into that folder.
Now, obviously you also want to go up a folder occasionally. To do this, type "cd .." or "cd..".
As you can see, we have moved out of "folder" and up into "tutorial".
You may also find local folders referenced like this:
This described a folder within the current directory (described by the ".")
To switch directories more quickly, we can use the TAB key to automatically complete foldernames for us.
E.g. if we are in "C:\tutorial" and want to go to "folder", we can type "f" and then hit TAB:
This will autocomplete the foldername for us, so we don't have to type it out.
If you have multiple folders that have a similar name, it will autocomplete until there is a difference between the names. You can then either hit TAB and cycle through the possible names, or type something to allow the system to distinguish between the folders.
Since we have 3 folders that have a similar name, it will only autocomplete until the part that differs. If we hit TAB again, it will cycle through other options:
If we want to know what files and folders are in a directory, we can type "dir" (Available everywhere) or "ls" (PowerShell / Windows Terminal only).
We get a List of folders and files in that folder. The "d" at the start of the line indicates a directory. We also get the last write access and the Name of the folder. If we had a file, "Length" would display the size of the file.
Using CMD, you can copy, rename, delete and edit files.
NOTE: There is no undelete in CMD. Once you delete a file, there is no restoring it.
As you can see, I have created a test file using notepad.
To remove a file, we use "del filename". Make sure you type the entire filename, including the file name extension.
Note that we didn't get a confirmation message, but the file is no longer shown when we run "ls".
To delete a folder, we can also use the "del command".
When you try to delete a folder that contains Items, CMD will ask you to confirm the action, as this will also delete any subfolders and files within this folder:
To create a folder with CMD, we type "mkdir <foldername>" (stands for make directory)
I have created a file called copyme.txt.
To copy a file using CMD, we use the "copy <file> <destination>" command.
As expected, the file is still in "folder", however, there is a copy of it in "folder2".
To copy entire folders and their contents, we use the "copy" command with a special parameter.
I have created a file in "folder2", as well as another folder "test", that also contains a file.
We will now copy all the files in that folder to another one. For that, we need to specify the -r parameter like so:
copy -r <source> <destination>
As you can see, all files and folders that were in "folder2" have been copied to "folder3", which was created because it didnt exist yet.
You followed the guide to Boot your PC from USB and started CMD.
First we will need to find out the drive letters of out USB Device and our Windows Disk.
You can recognise the windows disk because it contains the folders "Windows", "Users", and "Program Files".
Your drives might not be mounted automatically. Follow these instructions to mount them manually.
Switch to it using "<letter>:". (Here my windows drive is C: and my USB is E:)
Navigate to your files using "cd".
Copy your files to your USB drive using "xcopy /s".
Switch back to your USB drive to verify if all files have been copied.
As we can see, the file from Documents has been copied to E:. Repeat this for all files you might have on your computer.