command |
Description |
DIR |
Lists the content of a directory. To view more options use DIR /? |
CLS |
Clear the screen |
CD |
Changes to a new directory. For help type CD /? |
CD \ |
Changes to the root of the current drive |
CD .. |
Changes to the parent directory of the current directory |
MD |
Creates a directory in the current directory or path specified. For help type MD /? |
RD |
Removes a directory. For help type RD /? |
REN |
Rename a file |
> |
Redirect command |
Type |
Used to verify a file is created |
Copy |
Used to copy a file |
- Click in the Search Box
- Type cmd and hit Enter
Notice you will be at C:\Users\Your Username. Which is your user home folder. This is what was shown on my computer command prompt” C:\Users\student\Documents>” where student is my username
- Type dir
You will see all the directories that exist in your home folder
- Type cd Documents
You are now in the Documents folder.
- Type md folderA FolderB folderC
- Type dir
Observe how many folder are now in the Document directory
- Change to the FolderB Type cd FolderB
- Type the following commands below and hit Enter after each line is typed:
echo hello how are your > myfile.txt
for /l %a in (1 1 2) do type nul > “test%a.txt”
for /l %a in (1 1 2) do type nul > “execute%a.exe”
for /l %a in (1 1 2) do type nul > “excel%a.xls”
for /l %a in (1 1 2) do type nul > “word%a.doc”
for /l %a in (1 1 2) do type nul > “powerpoint%a.ppt”
- Type cls
- Type dir
Observe the different types of files that are created and look at the file extensions
- View all .exe files in FolderB. Type dir *.exe
- Copy all .exe files from FolderB to folderA. copy *.exe c:\Users\student\Documents\folderA
Note: student is the name of the user. So make sure you use the correct username. We also had to use the full path to folderA.
- Type cd ..
- Type cd folderA
- Type dir
Notice the file all the .exe files are copied to folderA. Go to the Documents folder using File Explorer and view all of everything you have created. Then go back to and continue working from the command prompt
- Rename the execute1.exe to program1.exe ren execute1.exe program1.exe
- Type cd ..
- Type tree to look at the folder hierarchy structure
- Delete all files that are in the Documents directory including those in folderA, and FolderB.
Type del *.* /s
- Verify the files were deleted type the following commands
cd folderA
dir
cd ..
cd FolderB
dir
cd ..
- Remove/delete the folder in the Documents folder. Type the following commands
rd folderA
rd folder
rd folderC
- Verify every has been deleted from the Documents folder. Type dir
That is the end of this lab
Kindly Leave Comments and Feedback in the comments Area
Link to Windows Commands: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands