Don’t be careless with these commands! Practising deleting files directly from your C-drive might have disastrous consequences!

If you are studying IT at school, or are teaching yourself to program, you should learn to be comfortable working at the Windows Command Line Interface (“CLI”), commonly called the Windows Command prompt. Please be careful as this UI (“User Interface”) is not as forgiving as the Windows GUI (“Graphical User Interface”) you are accustomed to!

Why?

Considering that you will have no cute icons and shortcuts and the mouse will be sidelined, why would you bother learning endless commands and switches when a GUI is just so user-friendly?

  • Fast performance: If you know how to use CLI and are familiar with different commands you will be able to complete many tasks faster than by using the GUI. You can perform multiple tasks by entering commands in the CLI.
  • Less memory: The CLI uses less memory as compared to the GUI.
  • Multitasking: CLI offers a great environment for multitasking.
  • Control: CLI provides more control over the system than a GUI.

You can also write scripts to perform tasks that can even be scheduled as batch files.

Opening the CLI

Open up the Command Prompt now:

  1. Windows Key on the keyboard. + R
  2. type cmd
  3. Click the OK button
Screenshot of the Windows Command Line Interface on a Windows 10.
Screenshot of the Windows Command Line Interface on a Windows 10.

Your username will appear in place of the word user in the screenshot above.

Extra skills

You can easily repeat commands once they have been executed using the & cursor keys to scroll through previously entered commands. You can auto-complete directory & file names using the TAB key.

Press the Enter key after typing each of the commands in the list below:

  1. Type dir to view the directory listing for the current directory
  2. Type cd Documents to change the directory to the Documents folder
  3. Type cd.. to move back up the hierarchy by one directory
  4. Type cd Doc and press the Tab key to autocomplete the name of the Documents folder to save you typing the full word

Commands you should know

cd

“change directory”

cd newdirectoryname

Change the command prompt to the new directory as specified by newdirectoryname (changes the active directory on the same drive only [1])

cd \

Change the directory to the root.

cd ..

Change the directory one level up the directory hierarchy.

copy

copy filename newfilename

Makes a copy of the file named filename and renames the copy to newfilename.

cls

“clear screen”

Clears the Command Prompt window.

del

“delete”

del filename

Deletes the file as specified by filename

del foldername

Deletes a folder and everything inside it (after a confirmation prompt)!

dir

“directory”

Lists the contents of the current directory.

Using the dir command in the Windows CLI on a Windows 10 computer.The result of using the dir command in the Windows CLI on a Windows 10 computer.

exit

Closes the Command Line window.

fc

“file compare”

fc file1 file2

Compares two files and displayed the differences as text.

Using the fc command in the Windows CLI on a Windows 10 computer.The result of using the fc command in the Windows CLI on a Windows 10 computer.

help

help command

Displays help for the command specified.

ipconfig

“Internet Protocol configuration”

Displays the Internet Protocol (“IP”) information for your device.

ipconfig /release

ipconfig /renew

md

“make directory”

md mynewdirectoryname

Creates a new directory with the name specified by mynewdirectoryname

move

move C:\myfile.txt C:\myfolder\

Moves the file C:\myfile.txt to a new location defined by C:\myfolder\

ping

ping ip

Sends messages to the specified IP address that are then echoed back by that host if it is available.

ren

“rename”

ren filename.txt newfilename.txt

ren foldername newfoldername

Using the ren command to rename a folder in the Windows CLI on a Windows 10 computer.The result of using the ren command to rename a folder in the Windows CLI on a Windows 10 computer.

rem

“remove directory”

Deletes a directory.

type

type MyProgram.java

Displays the contents of a text file.

Java students only

java

java MyProgram

Runs the Java program named MyProgram.class

java -version

Details of the installed JDK version at the command line.
Details of the installed JDK version at the command line.

javac

“java compiler”

javac MyProgram.java

Compiles the program in the text file MyProgram.java

Totally random

gpupdate

“group policy update”

gpupdate

Schedules a Group Policy update.

gpupdate /force

Forces the Group Policy update to run immediately.

gpresult

gpresult /R

This command line tool displays the Resultant Set of Policy (“RSoP”) information for a target user and computer.

Next steps


References:

  1. Hello71 (2010) change directory command doesn’t work in windows command promptSuper User. Available at: https://superuser.com/questions/165364/change-directory-command-doesnt-work-in-windows-command-prompt (Accessed: 16 January 2025).
  2. https://superuser.com/a/165368/469955
  3. Edwards, S. (2015). Windows Command Prompt Cheatsheet [PDF]. New York: Computer Science. Available at: http://www.cs.columbia.edu/~sedwards/classes/2015/1102-fall/Command%20Prompt%20Cheatsheet.pdf
  4. Jason Gerend. (n.d.). Windows commands. Available at: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands (Accessed: 2 February 2023).
  5. Gerend, J. (2023) Ping, Microsoft Learn. Available at: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping (Accessed: 28 August 2023).
  6. Gerend, J. (2023) gpresultMicrosoft Learn. Available at: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/gpresult (Accessed: 2 May 2024).

By MisterFoxOnline

Mister Fox AKA @MisterFoxOnline is an ICT, IT and CAT Teacher who has just finished training as a Young Engineers instructor. He has a passion for technology and loves to find solutions to problems using the skills he has learned in the course of his IT career.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.