All Tutorials

Your One-Stop Destination for Learning and Growth

Running Commands from Windows Operating System

Windows operating system provides a command-line interface (CLI) known as Command Prompt or PowerShell, which allows users to execute various commands and tasks. This blog post will cover some basic and essential commands you can use from the CLI in Windows OS.

Starting the Command Prompt

  1. Press Win + R keys together on your keyboard to open the Run dialog box.
  2. Type cmd in the text field and hit Enter to launch the Command Prompt window. Alternatively, you can also search for "Command Prompt" or "PowerShell" within the Start menu.

Navigating Directories (Changing Directories)

To navigate between directories:

  1. Use the cd command followed by a space and then the directory name or path you want to move to. For example, cd C:\Users\YourName\Desktop. You can also use cd .. to go up one level in the directory hierarchy or cd ~ to return to your home directory.

Listing Directory Contents

To list the contents of a current directory, type dir and press Enter. The command will display a list of files and directories along with their sizes and modification dates.

Creating New Directories

  1. To create a new directory, use the mkdir command followed by a space and then the name of the directory you want to create. For instance, mkdir myNewDirectory.

Renaming Directories

To rename a directory, follow these steps:

  1. Navigate to the parent directory using the cd command.
  2. Type renamedir oldDirectoryName newDirectoryName. Replace oldDirectoryName and newDirectoryName with your actual directory names. For example, renamedir myOldDirectory myNewDirectory.

Deleting Directories and Files

To delete an empty directory, type rmdir directoryName. To remove a non-empty directory, use the rd /s directoryName command to recursively delete all contents within the directory and then delete the directory itself. Be careful when using this command!

For deleting files, simply type del fileName.extension, replacing fileName.extension with the actual filename and file extension.

Closing the Command Prompt

To close the Command Prompt window, simply type exit and press Enter on your keyboard.

These are just some basic commands you can use in the Windows Command Prompt or PowerShell interface. For more advanced usage, refer to Microsoft's official documentation or other relevant resources online.

Published August, 2015