Windows command line execute command

Command Line Commands – CLI Tutorial

The Windows command line is one of the most powerful utilities on a Windows PC. With it, you can interact with the OS directly and do a lot of things not available in the graphical user interface (GUI).

In this article, I’ll show you 40 commands you can use on the Windows command line that can boost your confidence as a Windows user.

N.B.: You have to be careful while using the commands I’ll show you. This is because some commands can have a lasting negative or positive effect on your Windows PC until you reset it.

In addition, some of these commands require you to open the command prompt as an admin.
ss5-1

powershell start cmd -v runAs – Run the Command Prompt as an Administrator

Entering this command opens another command prompt window as an administrator:
ss1-1

driverquery – Lists All Installed Drivers

It is important to have access to all drivers because they often cause problems.

That’s what this command does – it shows you even the drivers you won’t find in the device manager.
ss2-1

chdir or cd – Changes the Current Working Directory to the Specified Directory

ss3-1

systeminfo – Shows Your PC’s Details

If you want to see more detailed information about your system you won’t see in the GUI, this is the command for you.
ss4-1

set – Shows your PC’s Environment Variables

ss5-2

prompt – Changes the Default Text Shown before Entering Commands

By default, the command prompt shows the C drive path to your user account.

You can use the prompt command to change that default text with the syntax prompt prompt_name $G:
ss6-1

N.B: If you don’t append $G to the command, you won’t get the greater than symbol in front of the text.

clip – Copies an Item to the Clipboard

For example, dir | clip copies all the content of the present working directory to the clipboard.
ss7

You can type clip /? and hit ENTER to see how to use it.

assoc – Lists Programs and the Extensions They are Associated With

ss8

title – Changes the Command Prompt Window Title Using the Format title window-title-name

ss9

fc – Compares Two Similar Files

If you are a programmer or writer and you want to quickly see what differs between two files, you can enter this command and then the full path to the two files. For example fc “file-1-path” “file-2-path”.
ss10

cipher – Wipes Free Space and Encrypts Data

On a PC, deleted files remain accessible to you and other users. So, technically, they are not deleted under the hood.

You can use the cipher command to wipe the drive clean and encrypt such files.
ss11

netstat -an – Shows Open Ports, their IP Addresses and States

ss12

ping – Shows a Website IP Address, Lets you Know How Long it Takes to Transmit Data and a Get Response

ss13

color – Changes the Text Color of the Command Prompt

Enter color attr to see the colors you can change to:
ss14

Entering color 2 changes the color of the terminal to green:
ss15

for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear – Shows All Wi-Fi Passwords

ss16

ipconfig – Shows Information about PC IP Addresses and Connections

ss17

This command also has extensions such as ipconfig /release, ipconfig /renew, and ipconfig /flushdns which you can use to troubleshoot issues with internet connections.

sfc – System File Checker

This command scans your computer for corrupt files and repairs them. The extension of the command you can use to run a scan is /scannow.
ss18

powercfg – Controls Configurable Power Settings

You can use this command with its several extensions to show information about the power state of your PC.

You can enter powercfg help to show those extensions.
ss19

For example, you can use powercfg /energy to generate a battery health report.
ss20

The powercfg /energy command will generate an HTML file containing the report. You can find the HTML file in C:\Windows\system32\energy-report.html.

dir – Lists Items in a Directory

ss21

del – Deletes a File

ss22

attrib +h +s +r folder_name – Hides a Folder

You can hide a folder right from the command line by typing in attrib +h +s +r folder_name and then pressing ENTER.

To show the folder again, execute the command – attrib -h -s -r folder_name.
ss23

start website-address – Logs on to a Website from the Command Line

ss24
ss25

tree – Shows the Tree of the Current Directory or Specified Drive

ss26

ver – Shows the Version of the OS

ss27

tasklist – Shows Open Programs

You can do the same thing you do with the task manager with this command:
ss28
The next command shows you how to close an open task.

taskkill – Terminates a Running Task

To kill a task, run taskkill /IM "task.exe" /F. For example, taskkill /IM "chrome.exe" /F:
ss29

date – Shows and Changes the Current Date

ss30

time – Shows and Changes the Current Time

ss31

vol – Shows the Serial Number and Label Info of the Current Drive

ss32

dism – Runs the Deployment Image Service Management Tool

ss33

CTRL + C – Stops the Execution of a Command

-help – Provides a Guide to other Commands

For example, powercfg -help shows how to use the powercfg command
ss34

echo – Shows Custom Messages or Messages from a Script or File

ss35

You can also use the echo command to create a file with this syntax echo file-content > filename.extension.
ss36

mkdir – Creates a Folder

ss37

rmdir – Deletes a Folder

ss38

N.B.: The folder must be empty for this command to work.

more – Shows More Information or the Content of a File

ss39

move – Moves a File or Folder to a Specified Folder

ss40

ren – Renames a File with the Syntax ren filename.extension new-name.extension

ss41-1

cls – Clears the Command Line

In case you enter several commands and the command line gets clogged up, you can use cls to clear all entries and their outputs.
cls

exit – Closes the Command Line

shutdown – Shuts down, Restarts, Hibernates, Sleeps the Computer

You can shut down, restart, hibernate, and sleep your PC from the command line.

Enter shutdown in the command line so you can see the extensions you can use to perform the actions. For example, shutdown /r will restart your computer.
ss42

Conclusion

This article showed you several “unknown-to-many” commands you can use to get access to hidden functionalities on your Windows PC.

Again, you should be careful while working with these commands because they can have a lasting effect on your OS.

If you find the commands helpful, share the article with your friends and family.

In case you know another useful command I did not list, tell me about it on Twitter. I will add it and mention you as the source.



Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

When working on the Windows command line, do you remember how often you kept looking for the same commands? Do you easily mistype in the Windows command prompt as if you were using bash commands, such as “rm” instead of “del”? If you’ve ever been in the situations above, this Windows command line cheat sheet is for you.

The Windows command line is only as powerful as the commands at your disposal, which we’ll expand on in this Windows command prompt cheat sheet. It covers every command you need for important tasks and batch scripting, plus a few delightful surprises if you make it to the end.

Keep a copy of this Windows command line cheat sheet on your desk, in your pocket, or wherever you go. When you’re ready, let’s dive in.

Windows Command Line Cheat Sheet Search

Search our Windows command line cheat sheet to find the right cheat for the term you’re looking for. Simply enter the term in the search bar and you’ll receive the matching cheats available.

What Is the Windows Command Line?

The Windows command line (Windows command prompt) is the command-line interface (CLI) on Microsoft Windows machines, analogous to the Terminal in Unix/Linux. It emulates many command-line abilities in Microsoft’s deprecated text-only operating system MS-DOS (but it’s not MS-DOS).

Methods to open the Windows CLI:

  • On Windows 10 or above, click Start on the bottom left corner, type cmd, and select Command Prompt.
  • On Windows 8.x or earlier, press Ctrl+R to open the Run dialog box, type cmd into it, and press Enter.

Hence, another name for Windows CLI is “cmd.”

Scripts containing Windows commands (batch scripts) have “.bat” as the file extension. All cmd commands are case-insensitive, so arp and ARP are the same. If you need help using any command, add /? to it, e.g., ARP /? will show the manual for ARP:

Table Of Contents

  1. Windows Command Line Cheat Sheet Search
  2. Directory Navigation
  3. File Management
  4. Disk Management
  5. Windows Command Generator
  6. System Information and Networking
  7. Process Management
  8. Batch Scripting
  9. Conclusion
  10. Frequently Asked Questions

Directory Navigation

These commands help you view directories and move directories around.

Command Explanation
c: Change the current drive to the C:\ drive
d: Change the current drive to the D:\ drive
CD c:\path\to\my_folder Change directory to c:\path\to\my_folder
CD .. Navigate to the parent directory of the current working directory
CD .\new_folder Navigate to the folder new_folder located in the current working directory
CD /D d:\videos\ Change the current drive to D:\ and access the folder videos on it.
DIR Display files and folders in the current directory
DIR /A c:\apps\ Display files and folders in the directory c:\apps\
DIR /A:D Display only folders (D: directories)
DIR /A:-D Display only files (D: directories; -: not)
DIR /A:H Display hidden files and folders
DIR /O Display files and folders sorted alphabetically
DIR /O:S Display files and folders sorted by file size from smallest to largest
DIR /O:-S Display files and folders sorted by file size from largest to smallest
DIR /B Display only the names of files and folders in the current working directory
SORT Take input from a source file/pipeline, sort its contents alphabetically (default: A to Z; in reverse: Z to A), and display the output
SORT "C:\music\playlist.m3u" Sort the contents of C:\music\playlist.m3u line by line
DIR /B | SORT /R /O ZtoA.txt List all file and folder names in the current working directory, sort them in reverse alphabetical order, and save the sorted output to a file ZtoA.txt:
MOVE Move a file or files
MOVE c:\f1\text.txt c:\f2 Move a file text.txt from one folder c:\f1 to another folder c:\f2
MD new_folderMAKEDIR new_folder Create a new folder called new_folder in the current directory
RD new_folderRMDIR new_folder Delete the folder called new_folder in the current directory
TREE Show the directory structure of a disk/folder
TREE "C:\Program Files" Show the directory structure of the folder “Program Files” on the disk C:\
TREE C:\ /F Display the names of the files in each folder in the directory structure of the C:\ drive
ATTRIB Display/set the attributes of the files in the current directory
ATTRIB +H +S +R myItem Hide a file/folder myItem
ATTRIB -H -S -R myItem Unhide a file/folder myItem

TREE demonstration

File Management

The following commands are for managing and manipulating files.

Like Unix, cmd supports pipelines: you may pass the output of a command to the next one by sandwiching the pipe character “|” between both.

Command Explanation
COPY text.txt C:\schoolwork Copy the file text.txt to a folder with the path C:\schoolwork
DEL text.txtERASE text.txt Delete the file text.txt
REN text.txt script.batRENAME text.txt script.bat Rename a file text.txt to script.bat
REPLACE .\src\hey.txt .\dest Overwrite; replace a file named hey.txt in a local folder src with another hey.txt in a local folder dest, both files sharing the same name.
Warning: Don’t specify .\dest\hey.txt anywhere here.
XCOPY Copy files and directory trees to another folder.
XCOPY is similar to COPY but with additional switches to specify the source and destination paths in detail.
XCOPY /S folder1 folder2 Copy folders and subfolders of folder1 to folder2
ROBOCOPY Robust copying of files and directories: by default, such copying only occurs if the source and destination differ in time stamps or file sizes.
EXPAND gameData.cab Decompresses the compressed .CAB cabinet file gameData.cab
FC file1.ext file2.ext Compare the contents of two files (file1.ext, file2.ext) and display non-matching lines
COMP file1.ext file2.ext Compare the contents of two files (file1.ext, file2.ext) and display non-matching items
FIND "python" in run.bat Output every line that contains a text string (which you must enclose in quotation marks) «python» in the file run.bat
FIND /C "python" in run.bat Count every line that contains a text string (which you must enclose in quotation marks) «python» in the file run.bat
PRINT resume.txt Print contents of a file resume.txt
OPENFILES /QUERY Query/display open files
OPENFILES /DISCONNECT Disconnect files opened by network users.
TYPE test.txt Displays the contents of the file test.txt
TYPE playlist.m3u | SORT /unique /o C:\work\unique_play.m3u Sort a file playlist.m3u and output only the unique values to a file C:\work\unique_play.m3u
MORE Display contents of one or more files, one screen at a time.
ASSOC Display or change the association between a file extension and a file type
NOTEPAD Open the Notepad application from cmd
NOTEPAD filename.ext Open a file filename.ext in Notepad

Disk Management

It’s easy to handle and automate the following tasks on cmd.

Command Explanation
CHKDSK Check and repair disk problems (local disks only)
CHKDSK /F A: Fix errors on A: drive
CHKDSK /R A: Recover data on A: drive
CHKDSK /X A: Dismount drive A:
CIPHER /E classified Encrypt the folder classified
CIPHER /D secret_recipe.txt Decrypt the file secret_recipe.txt
DEFRAG Disk Defragmentation
CHKNTFS Display/modify disk-checking on startup
COMPACT Display/change the compression of files in NTFS partitions
CONVERT Convert FAT disk volume to NTFS
DISKPART Display and adjust disk partition properties
FORMAT Format the disk
FSUTIL File system management
LABEL d:x Rename disk D:\ to X:\
SUBST p: c:\taxes Assign drive P:\ to the local folder c:\taxes
SUBST p: /D Remove the path represented by P:\
RECOVER d:\data.dat Recover a file data.dat from a bad or defective disk D:\
VOL Display current disk volume label and serial number
POWERCFG Control power settings and configure Hibernate/Standby modes
SFC /SCANNOW Scan and update protected system files

Windows Command Generator

Say goodbye to the hassle of trying to remember the exact syntax for the Windows command line! With our Windows Command Generator, you can simply say what you need Windows to do, and we will generate the command for you.

System Information and Networking

The following commands are helpful in troubleshooting computers and computer networks.

Command Explanation
VER Display the current operating system version
SYSTEMINFO List system configuration
HOSTNAME Show the computer’s hostname on the network
DRIVERQUERY Show all installed device drivers
DATE Display/set system date
TIME Display/set system time
GPRESULT Display Resultant Set of Policy (RSoP) information for a remote user and computer.
GPUPDATE Update group policies
IPCONFIG Display Windows IP network configurations
IPCONFIG /release Release your current local IP address
IPCONFIG /renew Request a new local IP address
IPCONFIG /flushdns Reset the contents of the DNS client resolver cache
PING google.com Send ICMP requests to the target google.com and check host availability
PATHPING Trace route and provide network latency and packet loss for each router and link in the path
NET Provide various network services
NET use M: \\gameServ /user:"ReadyPlayerOne" player1 Assign as disk M:\ the path \\gameServ, logging in as “ReadyPlayerOne” and password “player1
TRACERT Find the IP address of any remote host
NSLOOKUP Find IP addresses on a nameserver
ROUTE Manipulate network routing tables
ROUTE PRINT Displays network route details
ARP -A List IP addresses and corresponding physical addresses (Address Resolution Protocol)
NETSH Configure network interfaces, Windows firewall, routing, and remote access
NETSTAT Display current TCP/IP network connections and protocol statistics
GETMAC Shows all MAC addresses of the network adapters

Process Management

The commands below are Task Manager-like functions. Note that you call variables in arithmetic or logical expressions by enclosing each with two “%” signs (e.g., “%a%”).

Command Explanation
SCHTASKS Create/edit a job on Task Scheduler. Use this to create scheduled tasks in Disk Management.
SET List environment variables
PATH Display/change the list of folders stored in the %PATH% environment variable
SHUTDOWN /R Restart the computer
SHUTDOWN /S /T 60 Shut down the computer 60 seconds from now
TASKLIST List running tasks
TASKLIST /SVC Show services related to each task
TASKLIST /V Display detailed task information
TASKLIST | FIND "1234" Get the name of the executable associated with the process ID (PID) of 1234
TASKKILL End one or more tasks
TASKKILL /IM "msedge.exe" Terminate all Microsoft Edge instances:
TASKKILL /PID 10736 Terminate process with PID of 10736
REGREGEDIT Registry Editor
RUNAS /USER:user2 program1 Execute a program program1 as another user user2
POWERSHELL Open a Powershell instance

Batch Scripting

These commands are for constructing and debugging batch scripts (.bat). To suppress the output of a certain command, add @ in front of it, e.g., @echo off.

Demonstration of CHOICE, PAUSE, and TIMEOUT
Command Explanation
REM comment. . .
:comment. . .
Prefix for the single-line comment “comment. . .”
GOTO end
<comment_block>
:end
Format of multi-line comments represented by <comment_block> enclosed by delimiters end and :end
SET /A c = %a% + %b% Assign the arithmetic expression a+b to the variable c
^ Escape character
some_command > output.txt Redirect output of some_command to a file output.txt
? Wildcard representing one character
* Wildcard representing multiple characters
& Introduce a new command on the same line
TIMEOUT 3600 Tell the command prompt to sleep for 3600 seconds (= 1 hour)
PAUSE Prompt the user to continue
CHOICE Prompt the user to pick an on-screen option
CHOICE /T 15 /C ync /CS /D y /M "Press y=Yes, n=No, c=cancel:" You have 15 seconds to press Y, N, or C keys without capitalization, defaulting to “y” if time runs out without a decision
CLS Clear screen
CMD Restarts Windows command prompt window:
COLOR Set text and background color of cmd:
ECHO ON Display each command executed
ECHO OFF Only display command output
ECHO a string of characters Display a string of characters
HELP Display help
PROMPT topSecret^>$$ Changes the command line prompt to topSecret>$ for the current session
PROMPT Reset the command line prompt to default
START X Start/open a program/document X in a new window
TITLE top Secret Set the title of the current session of Windows command prompt to top Secret
/? Add this to the end of any command word (shown in ALL CAPS in this cheat sheet) to get help on the command, e.g., CD/? = manual for CD (change directory) command
| CLIP Append this to the end of a command to copy the command output to the clipboard
EXIT Exits the command line

Flow Control

Note the condition is a Boolean expression e.g., %a%==5.

Conditional Syntax
If IF (condition) do_something
If-else If (condition) (do_something)
ELSE (do_something_else)
Nested if IF (condition1) IF (condition2) do_something
Infinite loop :marker
do_something
GOTO marker
While loop :marker
IF (condition) (
   do_something
   GOTO :marker
)

Shortcut keys

Any Windows CLI cheat sheet must include methods to speed up your work, such as the following.

Key Effect
Tab Autocomplete
Ctrl+F Find text in console (opens dialog box)
F1, F3, F5, F8 Retype command
F2 Copy the current command leftward of the cursor
F4 Delete the current command rightward of the cursor
F6 Insert end-of-file character
F7 List previous commands from which you choose
F9 Retype a command by typing its line number in the command history

Conclusion

We sincerely hope this Windows cmd commands cheat sheet helps you finish your work quickly and efficiently today, especially if you’re prone to confusing Windows command prompt commands with other terminal scripting languages in the past.

Remember to check out our course offerings on Windows.

Frequently Asked Questions

Can I use the command line for coding?

Like bash, sh, and zsh, the Windows command line is a shell scripting language suited for automating line-by-line execution of programs callable from a command line interface. It’s not suitable as a programming language because it lacks data structures found in general-purpose programming languages such as Python (interpretive) and C++ (compiled).

What are the basic CLI commands?

They’re DIR, CD, CP, DEL, MOVE, REN, MKDIR, RMDIR, CLS, HELP, EXIT, and NOTEPAD. With these commands, a beginner can operate the Windows command prompt and manage most files and folders.

Is learning the command line useful?

Yes. Learning how to use it will allow you to discover your computer’s latent superpowers. You can automate tasks when combined with Run > shell:startup or Task Scheduler (both on Windows). The command line will help you manage and manipulate files and folders more quickly than comparable actions (e.g., drag and drop) on the graphical user interface.

Can CMD run Python?

If the machine has Python installed, then yes. Python isn’t native to Windows. Note that the command to run Python could be one of the following: python, py -2 (for Python 2); python3, py -3 (for Python 3).

Level Up in Cyber Security: Join Our Membership Today!

  • Cassandra Lee

    Cassandra is a writer, artist, musician, and technologist who makes connections across disciplines: cyber security, writing/journalism, art/design, music, mathematics, technology, education, psychology, and more. She’s been a vocal advocate for girls and women in STEM since the 2010s, having written for Huffington Post, International Mathematical Olympiad 2016, and Ada Lovelace Day, and she’s honored to join StationX. You can find Cassandra on LinkedIn and Linktree.

    View all posts

The command line (command line, console, terminal) in the Windows operating system is designed to work with the system in text mode. The software shell is used to connect the user with the operating system by entering text commands from the computer keyboard.

Working with the command line proceeds as follows: the user launches the cmd.exe application on the computer, the command line interface window (command line interpreter) opens, then the user enters a command or sets of commands from the keyboard, the system executes them, sometimes issues prompts or messages displayed in command line interface window.

To perform various tasks on the computer: launching programs, configuring the system, changing Windows settings, etc., you must enter certain commands for the command line.

At the dawn of the creation of operating systems, the OS did not have a graphical interface, all actions were performed using commands typed on the keyboard. After the appearance of the graphical interface, the command line did not disappear from the system.

Most users, sooner or later, come across the command line, the other part of the users are not even aware of its existence.

The advantage of the command line is that the command line is independent of the GUI of the operating system. The user enters commands in a command prompt window, and the system executes them immediately. In some cases, this process is faster than similar steps using the Windows GUI.

The command line is often used when problems occur on the computer, when it is impossible to perform work to fix system failures in another way.

It is difficult for novice users to work with the command line due to the fact that they do not know the commands. Therefore, the command line is more often used by advanced users and administrators.

In this article you will find a list of command line commands. The table contains the main command line commands that work in the operating systems Windows 10, Windows 8.1, Windows 8, Windows 7.

How to run command line

In Windows 10, finding the command line is not immediately obvious, so read this article about the different ways to launch the console in this OS.

In the Windows operating system, there are several ways to start the command line, here are the simplest ones:

  • From the “Start” menu, go to “Programs” (“All Programs”), and then to “System Tools” (in Windows 7 – “Accessories”), select the “Command Prompt” application.
  • In the search field, enter “cmd” (without quotes), among the results that open will be the command line.
  • After pressing “Win” + “R” on the keyboard, in the “Run” window, enter the command to launch the command line “cmd” (without quotes).

In normal mode, the command line is run as the user. To perform some actions on the command line, you need elevated Computer Administrator rights. In this case, the command line must be run as an administrator. Read the article on how to run the command prompt as an administrator on different versions of the Windows operating system.

How to run a command on the command line

Working on the command line is very simple: the user enters a text command, and then presses the “Enter” key (input). If you need to enter several consecutive commands, repeat this operation several times.

After launching the command line, the version of the Windows operating system is displayed in the command line interpreter window, and the location where the user is currently located. When started in normal mode, this is the address of the user profile on the system drive.

When running the command prompt as an administrator, the path looks like this: “C:\Windows\system32”.

Windows command line commands must be entered in the interpreter window immediately after the “>” sign, the cursor blinks in this place.

To copy a command from a computer and then paste the command into the command line, use the right-click context menu. Copy the command to the clipboard, paste the mouse cursor into the command line window, click the right mouse button. Windows 10 supports copying and pasting using standard keyboard keys: “Ctrl” + “C” and “Ctrl” + “V”.

Some system applications are launched immediately after entering a command that consists of the name of the application, for example, if you enter the “calc” command, then the Calculator system program will start on the computer.

For other programs, you will need to enter the full path to the application’s executable file. If there are spaces in the path to the file, the full path is enclosed in quotation marks, for example, the command to launch the Google Chrome browser looks like this:

"C:\Program Files (x86)\GoogleChrome\Applicationchrome.exe"

After running a command from the command line, the execution of the command is not always visible externally, due to the fact that there are internal changes in the operating system.

Other parameters are often added to the main command, keys to perform specific actions.

If you enter an incorrect command, such as a misspelled one, or if the Windows operating system is unable to execute the command for any reason, a message will appear in the command line interface window.

The user can independently learn the basic commands from the Command Line utility itself. To do this, just enter the command: “help”.

The CLI will display a list of basic commands.

To get information about the parameters of a particular command, you need to enter one of the following commands, which work in the same way (don’t forget to include a space):

command_name /?
help commandname

As a result, you will receive information about all the parameters of this command.

Windows Command Prompt: List of Basic Commands

Check out the table that summarizes the commands used in the Windows command line. If I missed any important command, write about it in the comment to this article, I add the command to the table.

Team Action to take
appwiz.cpl launching a system tool to change or remove programs
arp displaying and changing ARP tables for converting IP addresses to physical ones used by the address resolution protocol
assoc displaying or changing file name extension mappings
at launch programs at a specified time
attrib displaying and changing file attributes
azman.msc authorization manager
bcdboot tool to create and restore boot configuration data files
bcdedit editing changes in the system bootstrap database
break changing the processing mode of the key combination “Ctrl” + “C”
blastcln worm cleaning tool
bootcfg configuring, extracting, modifying, or removing command-line options in the Boot.ini file in Windows XP
call calling one batch file from another
cacls viewing and editing changing access control tables (ACL) to files
calc Launching the Calculator app
cd display name or change current folder
charmap symbol table
chcp print or change the active code page
chdir display or change the current folder
copy copy one or more files
chkdsk check disk for errors and display statistics
chkntfs output or change disk check options at boot time
ciddaemon file indexing service
cipher encrypting files and folders in NTFS
cleanmgr Disk Cleanup utility
cls screen cleaning
cmd launching another Windows command line interpreter
compmgmt.msc opening the computer management console
color setting default foreground and background colors
comexp.msc component services
comp comparing the contents of two files or two sets of files
compact viewing and changing file compression settings on NTFS partitions
compmgmt.msc Computer management
computer defaults selection of default applications
control Control Panel
control admintools administration
control desktop screen customization and personalization
control folder folder properties in explorer options
control fonts fonts
control keyboard opening the keyboard properties window
control mouse mouse properties
control printer devices and printers
control schedules Task Scheduler
control userpasswords2 user account management
convert converting the file system of a FAT volume to NTFS (does not work on the current disk)
copy copying files to another location
credwiz archiving and restoring usernames and passwords
date print or set the current date
debug debugging and program editing tool
defrag start disk defragmentation
del deleting one or more files
desk.cpl screen resolution setting
device pairing wizard adding a new device
devmgmt.ms Device Manager
dfrgui disk optimization (defragmentation)
dir listing files and subfolders from a specified folder
diskmgmt.ms opening the Disk Management snap-in
diskpart displaying and setting disk partition properties
diskperf enable or disable the performance counter
dokey command line editing, Windows command recall, macro creation
dpiscaling display settings
dxdiag DirectX diagnostic tool
echo displaying messages and switching the mode of displaying commands on the screen
endlocal end local environment changes for a batch file
erase deleting one or more files (wipe)
esentutl Microsoft Windows database maintenance utilities
eudcedit character editor
event create creating a special event entry in the specified event log
eventvwr.msc event viewer
expand decompress compressed files
explorer Windows Explorer
fc comparing files or sets of files, displaying the differences between them
find search for a text string in one or more files
findstr search for a text string in a file
finger information about the users of the specified system running the Finger service
firewall.cpl Windows Defender Firewall
for run the specified command for each file in the set
format disk formatting
fsmgmt.msc shared folders
fsquirt Bluetooth file transfer
fsutil displaying and setting file system properties
ftype inferring or changing file types when matching filenames
ftp FTP file sharing
goto transfer control to a specified line in a batch file
getmac display the MAC addresses of one or more network adapters
gpresult group policy information for a computer or user
graftabl display extended character set in Windows graphics mode
gpedit.msc Local Group Policy Editor
gpupdate updating multiple group policy settings
hdwwiz hardware installation wizard
icacls display, modify, archive, restore ACLs for files and directories
iexpress creating a self-extracting archive
if conditional processing in batch programs (files)
ipconfig IP address information
joy.cpl gaming devices
label creating, modifying, and deleting volume labels for disks
lodctr updating registry settings related to performance counters
logman managing the Alerts and Performance Logs service
log off session termination
lpksetup install or remove Windows interface languages
lusrmgr.msc local users and groups
magnify Launching the Magnifier app
main.cpl mouse properties
makecab archiving files to CAB archive
md creating a directory (folder)
mdsched RAM error checking tool
mkdir create directory (folder)
mmsys.cpl sound properties
mode configuring system devices
mofcomp 32-bit compiler
more sequential output of data in parts of one screen
mountvol creating, viewing, and deleting connection points
move moving one or more files from one folder to another
mrinfo work with multicast messages
mrt launching the Malicious Software Removal Tool
msconfig system configuration
msg sending messages to the user
msinfo32 system information
mspaint launching the graphic editor Paint
msra Windows Remote Assistance
net network resource management
ncpa.cpl network connections
netstat displaying protocol statistics and current TCP/IP network connections
netplwiz user account management
notepad launching Notepad
odbcconf ODBC driver setup
open files displaying a list of open files and folders open in the system
optional features enable or disable Windows features
osk launching the on-screen keyboard
path print or set the search path for executable files
pause pause batch file execution, output a message
perfmon system monitor
resmon resource monitor
popd restoring the previous value of the current folder, saved by the pushd command
prompt changing the windows command line
pushd saving current directory and then changing directory
ping sending packets to the specified address
power cfg system power management
print printing a text file
qprocess displaying process information
qwinsta display information about Remote Desktop Services sessions
rd deleting a directory
recover recovery of saved data on a damaged disk
recdisc creating a Windows recovery disk
reg registry command
regedit Registry Editor
rem placing a comment in a batch file or in a config.sys file
ren renaming files and folders
rename renaming files and folders
rmdir deleting a directory
replace file replacement
rstrui restoring windows from system restore points
runas to use applications on behalf of another user
rwinsta resetting the values ​​of subsystems of equipment and programs of the session to the initial state
secpol.msc local security policy
services.msc services
set listing, setting and removing Windows environment variables
setlocal start local environment changes in a batch file
sc display and configure services (background processes)
sfc checking the integrity of all protected system files and replacing the wrong ones
sigverif file signature verification
shift changing the contents of the overridden parameters for a batch file
slui Windows activation
sndvol volume mixer
start launch the specified program or command in a separate window
schtasks launching programs and executing commands on a PC according to a schedule
sdbinst compatibility database installer
shutdown restarting or shutting down the computer
sort sorting program
subst map a drive name to a specified path
sysdm.cpl properties of the system
systeminfo operating system configuration information
taskkill force termination of a process or application
tasklist show all tasks currently running, including services
taskmgr Task Manager
tcmsetup telephony client installation
time viewing and changing the current time
timedate.cpl time and date setting
title assigning the title of the current command line interpreter window
tracert trace route to the specified node
tree graphical display of the structure of a given drive or folder
tscon attaching a user session to a remote desktop session
tsdiscon disconnecting a Remote Desktop Services session
tskill process termination
type displaying the contents of text files
typeperf displaying performance information on the screen or in a log
utilman accessibility center
ver display information about the version of Windows
verifier driver check manager
verify setting Windows to check whether files are written to disk correctly
vol print volume label and serial number for disk
vssadmin command-line tool for administering volume shadow copy service
w32tm show current settings to display time zone
winter Windows version information on the screen
wmic information about the WMI toolkit in the interactive command shell
write wordpad text editor
wscui.cpl security and service center
wusa standalone update installer
xcopy copying files and folder tree

Article Conclusions

The command line in the Windows operating system allows the user to control the computer without using a graphical interface. To perform certain actions on a PC, you must enter special commands into the command line interpreter. This article published a table with a list of the most popular commands for the Windows command line.

Everyone who uses Windows on a daily basis has definitely bumped into the command prompt every once in a while. It’s one of those things that you know exists, but most likely have no idea how to use or what it’s for. Most advanced users know a few basic commands, but very few know how to fully take advantage of the Windows Command Prompt.

That’s why it’s a damn good thing you are here. You are about to learn everything there is to know about the Command Prompt, also known as cmd or console. We will start off with the basics, like different ways to open it, as well as basic navigation and file modification. After that, we will move on to more complex commands and features.

No matter if you’ve never touched the command prompt before or you are an expert at it, you will definitely find tons of useful information in this guide.

If a video format is more your style, you can check out this guide on our YouTube channel. It won’t be as in-depth, but contains all the main commands and features you need to learn.


What is the Command Prompt?

Command Prompt or CMD is a command line interpreter, in which the user interacts with the the command prompt through its command-line interface. It can be used to interact with the Windows operating system through various built-in commands. It is not a cross-platform application, as it is native to Windows, unlike it’s big brother, PowerShell which works on many other operating systems.

The command prompt was most popular in its early days, as the user interfaces were a lot more limited back then. Navigating through the files on a computer was simple when using only the keyboard. Nowadays most people don’t know how to use cmd because there is often no real need for it.

Many of the basic functions in command prompt can be done easily with basic mouse operations and menus, so most end-users will never need to use CMD. However, even in the age of mouse dominated PC operations, there are tons of useful things you can only accomplish through the command prompt on Windows and that’s what we’re here to find out.

Let’s start off with the basics first, then move on to some more complicated examples and commands.


Quick Ways to Launch Command Prompt

The best thing about command prompt on windows besides its many uses; is how fast you can get it going. The easiest way to open it up is to just open up your start menu and look for the Command Prompt within it, but there are a few faster alternatives.

The easiest and probably fastest way to launch CMD on Windows operating systems is by pressing the Windows Key and typing in ‘cmd‘. You should then see the command prompt icon appear and then you can open it up by clicking on it. This is the way I tend to open it up, as I don’t use the command prompt more than a few times a week.

Opening Command Prompt Through Start Menu

If you find yourself using the command prompt on a daily basis, it might be a better idea to pin the command prompt to your taskbar. This way it’s just one click away at all times.

In order to pin command prompt to your taskbar, first you need to find it in the start menu with the method showcased above. Then all you need to do is right-click on the app icon and select the ‘Pin to taskbar‘ option. Now you should see the CMD icon on your Windows taskbar at all times.

Pin Command Prompt to Taskbar


Run Command Prompt as Administrator

Sometimes you need to let Windows know that you have enough permissions to access certain directories and files. This includes other users folders and sensitive files within folders like System32, which might cause issues when tampered with. Also if you are going to be running batch scripts or using advanced commands, you need elevated permissions.

The easiest way to run command prompt as administrator is by finding it in the start menu as shown above, then right-clicking it and selecting the ‘Run as administrator‘ option from the drop-down menu. However, there is an even easier way to accomplish this if you pinned the app to your taskbar.

If you wish to automatically run cmd as admin every time you open it, just follow these simple steps. First, right-click the icon in your taskbar and then right-click the ‘Command Prompt’ selection from that pop-up menu as well. Once you see the menu, you could just run it as administrator from there, but select the ‘Properties‘ tab instead.

Open Cmd Properties Windows 10

When you have opened up the ‘Properties‘ window, look for the tab labelled ‘Shortcut‘ and select it. Once you’re there, click on the ‘Advanced…‘ button to open up the advanced properties of the CMD shortcut. Finally, the last thing you need to do is tick the ‘Run as administrator’ checkbox. Now just click OK on both menus and you’re done.

Cmd Properties WindowCmd Properties Run As Administrator

After this step is done, every time you click on the command prompt icon in your taskbar, it will launch as admin automatically. This will save you a few clicks and you don’t ever have to remember to do it again. In order to make sure that you are running the cmd as an admin, you should see the text ‘Administrator: Command Prompt‘ at the top toolbar of the window.

Cmd Toolbar Admin Notification


Command Prompt vs Windows PowerShell

You might have already heard about PowerShell, but might not know what it is or how it differs from the normal command prompt. In a nutshell, PowerShell is a more complex and powerful alternative to cmd, a Command Prompt on steroids. You can do everything with PowerShell that you can do with cmd and much more.

The reason why most people have never used PowerShell, is because it hasn’t been integrated with Windows operating systems until Windows 7. Ever since then, it comes pre-installed and you can find it in the same manner as the cmd through your start menu. You can also pin it to the taskbar and run as admin the same way.

You can launch PowerShell just as you would CMD, but there is also a new quick method to do this in Windows 10. The best way to quickly open PowerShell on Windows by pressing the Windows key + X to open up a hidden menu. From that menu you can find ‘Windows PowerShell (Admin)‘ from which you can instantly open PowerShell as an administrator.

Open PowerShell as Admin

In the end it’s completely up to you if you wish to use the default Command Prompt or PowerShell, but here are some benefits of using PowerShell:

  • PowerShell uses the .NET framework allowing users to use actual programming libraries and allowing for the creation of custom commands.
  • It’s cross platform so you can use your newly learned skills on Windows, Linux and MacOS while the normal Command Prompt is only usable on Windows.
  • PowerShell uses a lot of easier-to-understand commands and tons of documentation about all commands through the Get-Help command.
  • It has a higher learning curve as there’s a lot more things to learn about, almost like learning a new language. This means there’s more potential as well.
  • Most end users will only ever need the CMD, which is why we will stick to it in this guide, but if you’re feeling up for it, we recommend you start with PowerShell as it will be more beneficial for you in the long run.

If you would like a guide similar to this one about Windows PowerShell, let us know in the YouTube video comments or through our About Us page.

You can find more information and documentation about the app on the official PowerShell Microsoft Documentation page.


Few Important Base Commands to Learn in CMD

To start your CMD journey, there are a few basic commands that are going to help you on your way.

As with all new software and applications, it’s great to have instructions or a user manual. Although this guide should have you covered, it’s nice to know how to find help within command prompt itself.

In order to find a neat list of all the basic commands within CMD, all you need to do is type in help and press enter.

The list above is a great refresher on the available commands, but they don’t explain much usage wise. That’s why there is a different documentation command which provides more in-depth information for each command.

In order to see the guide for a specific command, you can type help COMMAND or COMMAND /? both of which will show the same information.

Command Prompt Help Information

If you see ‘Press any key to continue…’ at the bottom, you can press any key to open up the rest of the info.

Now that you have a huge wall of text in your command prompt, you might be wondering how to get rid of it. Thankfully there’s a command for that instead of just scrolling down constantly.

In order to empty out the cmd of all text, you need to type in cls which stands for Clear Screen. It’s extremely useful once your prompt starts to get cluttered.

Another quick useful tip is that you can paste whatever text is on your clipboard by simply right-clicking anywhere on the command prompt window.

In order to copy whatever your command outputs, you can simply add | copy after the command. This will copy any results onto your clipboard.

It is good to note that all commands within the cmd are NOT case sensitive, so you can write in upper- or lower-case letters as you please. For example, help and HELP are the same command and work just fine. I prefer writing everything in lower case, as it seems faster.

Finally, if you don’t like to move your mouse to exit the command prompt, you can simply type exit in order to close down the cmd instantly.


System & Folder Navigation

Now we’re ready to get into the thick of things. These commands are the first thing you need to learn in order to navigate through your system within command prompt. They consist of changing folders and directories as well as switching between drives.


Change Directory (cd)

This is usually the first command you learn when starting out with cmd. When starting up the command prompt as administrator, you start out in the C:\WINDOWS\system32 folder.

In order to move up one level in the folder hierarchy, you need to type cd .. so if you execute this command twice, you will be in the root of your C:\ drive. In addition, to go directly to the root level, in this case the C drive base, you can simply type cd / with or without the white-space.

Command Prompt Change Directory

Notice that the whitespace after cd is not necessary for the command to work.

If you want to change the drive you are working in, all you need to do is type in the drive letter followed by a colon. For example, if you would like to change from C:\WINDOWDS\system32 to X:\ just type in X: and you’re done.

If you want to move to a specific folder within the current directory you can type in cd DIRECTORYNAME which is one of the most used commands. You can also press TAB while writing the folder name to auto-fill it. It will speed up your process and navigation a lot.

In order to move to specific path on the current drive, you can type the entire path after cd to jump there. For example if you’re located in C:\, you can type cd Windows/System32 to move up directly to the System32 folder.

If you want to jump to a different hierarchy on the same drive you need to start off with the drive letter. For example you can type in cd C:/Users/TechTipVault to move directly to that folder, no matter where you are currently.

Similarly if you want to jump to a path on a different drive, you need to add in cd /d and then the full path. For example if you want to move from C:/Users to X:/Users, you need to type in cd /d X:/Users and voilà.

Command Prompt Change Directory All Commands

Here are some examples of the commands listed above.

Finally, it’s good to note that it is good practice to surround any folder names with quotes if they contain white-space. It is not required in all cases, but it is good to get used to. For example, you should type a path like this: cd C:/"Program Files (x86)"/"Tech Tip Vault"/dot_com


List Files and Directories (dir)

When you’re navigating through your system with cmd, you often want to know what your options are in the active directory. Thankfully there is a very versatile command that allows you to see all the files, directories and sub-directories in the current folder.

In order to see basic information about every file and folder in the current directory, type dir in the command prompt.

If you want to view the contents of a folder you’re not currently in, you can also use dir for that. The catch is, you need to use back-slashes or quotes for the file-path as otherwise the path won’t be recognized. This is due to the additional parameters that can be used. For example, if you want to see the contents of the Users folder, you can either type dir C:\Users or dir "C:/Users" as both options work the same. It just really depends on if you hate typing back-slashes as much as I do.

This command has tons of optional parameters that decide the amount of details and items to show. You can view all of them using the help command by typing dir /? but we will explain some of them here for clarity.

Parameter Example Explanation
/A:ATTRIBUTE or /A:-ATRRIBUTE dir /A:D
dir /A:R
dir /A:H
dir /A:-D
dir /A:-D-H
Show all folders
Show Read-Only files
Show Hidden files
Do NOT show folders
Do NOT show folders or Hidden Files
/O:SORTINGORDER or /O:-SORTINGORDER dir /O:N
dir /O:S
dir /O:D
dir /O:E
dir /O:D-N
Sort by filename
Sort by file size
Sort by Date & Time
Sort by File Extension
Sort by Date & Descending Filename
/T:TIMEMODE dir /T:C
dir /T:A
dir /T:W
Sort or view by Creation time
Sort or view by Last Access time
Sort or view by Last Written time
/S dir /S Include all sub-folders
/B dir /B Bare format (no header, size, or summary)
/L dir /L Use lowercase letters
/Q dir /Q Show the owner of the file
/N dir /N Long format with filenames on the right
/X dir /X Long format with short filenames
/C or /-C dir /C Include/Hide thousand separator in file size

Launch and Application or Program

The last thing that you should know when navigation through your system in command prompt is how to start an app through it. Thankfully it’s as simple as navigating to the correct folder and typing the name of the executable.

For example, if for whatever twisted reason you wanted to start up another command prompt instance from within the command prompt, you can do that. First you need to navigate to System 32 folder with cd /d C:/Windows/System32 and then type in start cmd to launch a new instance of cmd.

You can also start an app simply through the full file-path. For example, to launch MS Paint you can type in C:/Windows/System32/mspaint.exe and the software will start up instantly.


File & Folder Editing

File and folder editing is the bread and butter of the command prompt. These are the main commands you will be taking advantage of when using cmd. Once you get the hang of the navigation first, you will be ready to get going with the editing itself.


Make Directory (md)

The first command will let you create a new folder or directory. The md command is an alias for the longer version mkdir which both do the same thing. As long as you remember one of them, you’re good to go.

In order to create a new folder in the current working directory, type md FOLDERNAME. You can also create multiple nested folders by just adding them in with slashes. For example, if you want to create folders and sub-folders at once, type in md TechTipVault/SubFolderName/EvenDeeperFolder and now you have a triple layered folder hierarchy.

If you want to create multiple folders within the same directory, you need to separate the folder names with white-space. For example, in order to create 3 folders within the active directory, type up md Folder1 Folder2 Folder3 and now you have three new folders to work with.

It is good to note that white-space or special characters like commas, equals or semicolons will separate multiple folders. This means if you want to add special characters or spaces within the folder names, you need to add the folder name between quotation marks. For example, to create two folders with spaces in the names, you can type md "Folder 1" "Folder 2 = Folder 2". Now you will have 2 new folders, one called Folder 1 and the other one called Folder 2 = Folder 2.

Finally, you can create a folder with the above commands directly into any location by writing the entire path after the command. For example, if you are currently in C:/Users folder, you can type md X:\TechTipVault\EpicFolder to create a new folder on a different drive. Make sure to use back-slashes for the path or it won’t work.

Command Prompt Make Directory Commands

You can use the up-arrow key to move back to previously used commands.

Rename Files & Folders (ren)

The rename command is one of the most useful commands cmd has to offer. It allows you to rename any files and even change their extensions, transforming the file into a different type.

Simply renaming a file can be done by typing ren tipvaulttech.txt TechTipVault.txt in order to name the file into the latter format. You can also use this same syntax to rename a folder.

As you might expect, you can use the same logic to change the extension of a file. By typing ren TechTipVault.txt TechTipVault.html you will change your text file into an html file.

The best part about the renaming syntax in the command prompt is the ability to use wildcards. You can use * and ? characters to make complicated naming scenarios very easily.

Below is an interesting example utilizing the forward slash, which is not really documented anywhere, but a fun use-case can be seen utilized to remove parts of the filename.

Initial Song Names before Rename Command ren "Artist - " "/////////.*"
(Add same amount of slashes as
characters found on the left side)
Final Song Names before Rename Command

The * symbol basically means every character before the character that follows it. For example, if you wanted to transform every text file in a folder into log files, you could accomplish this by typing ren *.txt *.log noting the space(s) in between. The first “*” takes the original name and the second “*” replaces any character after (and including) the dot with .log.

The ? symbol finds the next character after it and appends it to the target name (as long as the next character is not a .). If the next character is a . then no character will be added in to the result.

For example, if you add 5 question-marks, it will replace 5 (or less) characters before a dot. See the examples in the table below.

If both are combined *?, they will append all remaining text from the source name to the target name and vice versa.

Initial Files Command Final Files
ttv.txt
TechTipVault.html
file1.xyz.log
1. ren *.* *.
2. ren * *_NEW.log
ttv_NEW.log
TechTipVault_NEW.log
file1.xyz_NEW.log
abc.abc
12345.12345
ABC123.docx
TechTipVault.Backup.log
ren * ????.????
(4 times ? on each side)
abc.abc
1234.1234
ABC1.docx
Tech.Back
ttv.txt
TechTipVault.xxx.dat
a.b.c_d
ren * *?.bak ttv.txt.bak
TechTipVault.xxx.dat.bak
a.b.c_d.bak

Copy Files & Folders (copy |xcopy)

When looking to copy things, it’s good to note that there are two separate commands you need to use. You have to use the copy command in order to copy files and the xcopy command to copy folders and their contents. Both of these commands also have their own parameters and options to give you more options.

Copy Files (copy)

Let’s first go in-depth with copying files using command prompt. The simple and easy basic functionality of this command is copy filename.ext newfilename.ext which will copy the file with a new name in the active directory.

Similar to most of the other commands, you can copy files from the active directory to a different folder or drive by adding their separate paths. For example, copy "C:/Users/TechTipVault/Epic Text File.txt" "X:/TechTipVault/CopiedVersion.txt" will copy a file (even with white-space in the name) from the C-drive to the X-drive.

A unique feature with this command is the possibility to merge text files into a single new text file. For example, if you want to merge every text file in a folder into a single one, you can use copy *.txt "\TargetDirectory\CombinedFileName.txt" and you now have a nice wombo-combo. Check the example below.

Command Prompt File Copying - Initial FilesCommand Prompt File Copying - Required CommandsCommand Prompt File Copying - Final File

Copy Files and Folders (xcopy)

Now let’s dive into the xcopy command. It is very similar to the normal copy command but provides more parameters and switches to take advantage of.

The basic syntax for copying files with xcopy is the same as with the normal copy command, which is why you should use that one instead. The main reason for this is because when using xcopy, you can’t tell if the target should be a file or a folder. If you do this, you will be prompted to enter either ‘F’ for file or ‘D’ for directory into the command prompt. In order to ignore this prompt and default as a file, you can add a wildcard (*) to the end of the target as such xcopy source.txt target.txt*

Command Prompt XCopy for Files

Finally, there are a few parameters you should be aware of with xcopy, although most of them are not very useful. You can type xcopy C:\Users\TechTipVault\FolderWithStuff X:\TechTipVault /S /I in order to copy every file, subfolder and files in the subfolders to the target folder. Here you can see the most important parameters that can be combined with the xcopy command.

Parameter
(Usage: xcopy source target parameter)
Explanation
/S Copy folders and sub-folders
(including files within them) (excluding empty folders)
/E Copy folders and sub-folders
(including files within them) (including empty folders)
/I Assume the target is a Folder (type)
/Y Suppress the prompt for overwriting files. (Overwrites duplicates without warnings)
/T Copy entire folder structure, but ignore any files.
(/T /E combo will also include empty folders and subfolders)
/K Copy attributes (otherwise things like read-only attributes will be reset)

Modify File Attributes (attrib)

The attribute command is quite a simple but useful affair. It allows you to display a files attributes or change them to your liking. Attributes mean features like being Read-only or hidden files.

With this command you can add an attribute with a + symbol and disable an attribute with the - symbol. The two basic attributes you will be using are R for Read-only and H for Hidden. The Hidden parameter also works for folders, but the Read-only attribute can only be applied to files. There are also A for Archive and S for System attributes, but they are rarely used.

You can also use the /S modifier to apply the attributes to all files within sub-folders as well and /D to apply the changes to selected folders too. As with most file editing commands, you can also use wildcards with the attrib command to easily modify a group of files instead of just one.

The basic syntax to make a file hidden and remove its read-only property can be done as follows: attrib +h -r SuperSecretPasswords.txt


Delete Files (del)

The delete command is unsurprisingly quite self-explanatory. It can be used to delete files. However, it is not possible to remove folders with it, as that’s what the remove directory command is for, discussed below.

Thankfully, to make the del command a little more useful, it includes plenty of parameters for more specific deletions alongside the ability to use wildcards for filenames. As for basic usability, you can type one or multiple filenames after the command as such: del file1.docx "Tech Tip File.log" "X:\TechTipVault\File.txt"

A cool feature of the del command is if you use it on a folder, all the files within the folder will be deleted but the folder itself will remain intact.

Command Prompt Delete Folder Contents

Now let’s get to the parameters you can use alongside the delete command. Here’s a quick list of the useful ones:

Parameter
(Usage: del parameters /A:attributes filesToDelete)
Explanation
/F Ignore read-only settings and force-delete the file
/Q Don’t show Yes/No prompt when deleting file
/A Use this before adding file attributes (/A:format)
/A:R or /A:-R Delete files that are Read-only or not Read-only
/A:H or /A:-H Delete files that are Hidden or not Hidden

You can combine multiple attributes by adding multiple of the parameters after the /A: syntax. There are a few more attributes, but rarely used in default cases. If you would like to learn more about them, check the documentation for the command with del /? syntax.


Remove Directory (rd)

The remove directory command is a very simple alternative to the delete command, but it allows the deletion of folders. The rd command doesn’t allow for the use of wildcards and only has 2 parameters, which makes it a lot easier to remember.

The usage of this command is simple, you can delete any amount of folders and their contents by simply typing rd FolderPath but without parameters, it will only delete an empty folder.

The parameters include: /S which deletes all files and sub-folders alongside the folder itself and /Q which will remove the Yes/No prompt on deletion. For example, rd /S /Q "X:\TechTipVault\GarbageFolder\" will delete the whole GarbageFolder and all of its contents without asking for confirmation for the deletion.


Advanced Command Prompt Commands

This is going to be the most exciting section of the entire command prompt ultimate guide. We will feature all the awesome commands you can use to find tons of useful information about your system and do things like repair corrupt files. These are the commands you will find yourself using over and over again and will want to tell your friends about.


Check All File Associations (assoc)

This command allows you to view or change what a file extension stands for. The basic usage is as simple as assoc .txt to find out what program the .txt extension is associated with.

If you want to add or change an association to a file extension, you can use similar syntax as to what you receive as a result from the base command. For example, if you want to associate the .log extension as a text file, you can type assoc .log=txtfile.

Similarly, if you would like to remove a file association, you can just type assoc .log= and execute the command.


File Comparison (fc)

The file comparison is another interesting command. You can use it to find differences in files using binary or ASCII format. If you want to compare files with an ASCII format comparison, you need to add /a after the command and in case of binary comparison, add /b after the command. Then just enter the filenames or paths to compare.

You can also add /number like /1 which is the number of lines that need to match for the file to be considered synchronized. It is quite difficult to explain clearly, which is why I highly recommend you do some testing on your own to really notice how the differences are laid out (we also added some pictures below to explain this further). Another very useful parameter is /n which will show the line numbers next to the text lines within the command prompt.

The basic formatting of the differences in the command prompt results are as follows:

  1. Name of the first file
  2. First row that matches
  3. Differences
  4. Second row that matches after the differences
  5. Name of the second file
  6. Same as steps 2-4 but for the second file
  7. Rinse and repeat

Command Prompt File Comparison DifferencesCommand Prompt File Comparison With 1 Line

Click to enlarge image
Command Prompt File Comparison With 2 Lines
Click to enlarge image

The use-cases for binary comparison (/b) are a lot more limited, as most end-users won’t have need for it. It’s best used when trying to find out if two non-text files are duplicates. This can be useful when looking for duplicate images with different names, for example, as the binary differences will show up.


Check IP-Address & Network Information (ipconfig)

This is without a doubt the most well-known command out of anything we list here. Everyone who has done any gaming or connection related things, has probably used ipconfig to find out their IP-address.

There’s not much to explain about ipconfig as what you see is what you get with the results. However, the command has a few cool parameters you can take advantage of to see more information and perform a few unique functions as well.

Probably the most useful parameter for this command is the /all command which shows the full TCP/IP configuration for all your network adapters. This way you will see all the information you need and there’s really no reason not run the command with this parameter every time.

Another very useful option to use with ipconfig is the /flushdns parameter. You can use it to clear your DNS cache. On the same note, you can also view your DNS cache with /displaydns to see if you should be clearing it up with the previous parameter.

For clarification, a DNS or a domain name server basically converts a domain name or URL (for example techtipvault.com) into an IP-address that the computer can understand and connect to. You system hold a record of these conversions to speed up repeated requests to same addresses and that record is called the DNS cache.

The reason why you might want to flush your DNS cache is because sometimes there’s out-dated conversions if a website has moved to a different server for example. You can flush your DNS cache to update those records on the next connection attempt.


See All Your Active Connections (netstat)

You can use the Network Status or netstat command to view all the connections going out and coming in to your machine. This command is mostly popular among Indian tech support scammers as they attempt to convince their victims there are hackers connected to the PC by typing in this command.

This command also a has a few parameters to increase its functionality. For example, you can use -a to display all connections and listening ports. You can also check out your Routing table by adding in the -r parameter.

Probably the most useful parameter that can be used with netstat is -b which will display the executable names with which each connection is associated with. This means you can easily see which connections are attached to your web browser or any other process.

Finally, you can add a number to the end of the command after all the parameters to indicate how fast you would like to automatically repeat the command (in seconds). If you don’t add a number, the command will only execute once. Typing netstat -b 10 would show the executable above each connection and command would repeat once every 10 seconds. In order to stop the repetition, you need to press Ctrl + C.


Show Optimal Route to Target Address (tracert)

The Trace Route or tracert command will tell you the optimal route from your system to the target IP-address or URL. It will also show that exact route step-by-step and tell you how long it took between each step or hop. It is fantastic for troubleshooting issues within large networks as many different paths can be acquired to arrive to a target machine.

The command has a default limit of 30 hops which means it will attempt to find the fastest route within 30 jumps from one router to the next. You can use the -h parameter to change the max hops, so tracert -h 10 techtipvault.com would use a maximum of 10 hops to reach the target.

TraceRoute With Command Prompt

Conveniently, you can also see the IP address if you type in a URL. This can also be accomplished without the hops using the ping command, explained below.

It is also good to note that trace route shows the most optimal route, not always the ACTUAL route it takes.


Send Test Packet & Check Connection to Target Address (ping)

The ping command is used to test or ping the target IP-address to see if there’s any issues in the connectivity. It is very similar to the tracert command, but pinging is quicker as it just tells you if a specified target can be reached and how long it takes to send and receive packets to that target server.

It is as quick and simple to use as typing ping techtipvault.com to see the target IP-address as well as response times.

The ping command has a lot of optional parameters to use, but most of them are not useful for most users so if you’re interested, you should check out the information page by typing ping /? into the command prompt. The most useful one is probably -n number to specific the amount of ping attempts and -w number to specify how long to wait for each reply from the server in milliseconds.


Lookup the IP-Addresses on a Nameserver (nslookup)

The name-server lookup command in its simplest form is a way to find what IP addresses belong to a target address. This can be done simply by typing nslookup techtipvault.com to find the connection details.

Command Prompt NSLookup

This command has a special Command Mode which can be accessed by typing the command without any parameters. Doing this will activate a mode where you can execute a bunch of unique commands to do name-server testing. You should check the command prompt info page (nslookup /?) for the special commands, as there are too many of them to explain here.

If you wish to exit the Command Mode, you can simply use the Ctrl + C keyboard shortcut.


Check Your System Specifications & Drivers (systeminfo | driverquery)

The System Info command is a great tool to quickly check your operating system information and other info like how much RAM you have installed. It is organized in a neat list so it’s easy to read and even copy if needed.

You can also see your network card information as well as Hyper-V requirements which are needed by some monitors and features like Miracast. It is possible to check remote system info as well by typing systeminfo /S targetSystem /U username /P password, noting you don’t need to use the username and password parameters if nothing is set-up for them.

To see a comprehensive list of all the drivers operating on your system, you can use the driverquery command. It uses the same syntax for remote connecting username and password wise as seen above.


Get a Power Efficiency Report of Your System (powercfg)

This is an interesting utility which allows you to see all kinds of information about your power usage. There are tons of parameters to take advantage of to view and modify your power schemes among other things.

The most useful one is powercfg /energy which will run a 60 second test of your computers power efficiency. The command will save a full report as an html file in your active directory so you can see any potential issues in full detail.

Command Prompt Power Efficiency Report

To check the other commands, again, type in powercfg /? to see what parameters are available for use.

Note that you need to run the command prompt as administrator to use this command.


Check the Integrity of Your Files and Fix Them (sfc)

The System File Scan is a great utility to make sure you don’t have any corrupted system files on your machine. The command will basically scan all of your protected system files and check their integrity.

The most useful and popular command is the /scannow parameter, which scans all the files and replaces any faulty ones with the official Microsoft files. Sometimes it might require the official installer files to replace them, so you need to follow any instructions given if this is the case.

The simpler version of this parameter is /verifyonly which does the same scan telling you of any problems, but it won’t do any repairs unlike the prior command.

Similarly, you can use /scanfile to check and repair a specific file or /verifyfile to check the integrity of a file, but no automatic repairs are done. With these parameters, you need to add the full path to the target file after an equals sign like so: sfc /scanfile=C:\Windows\System32\kernel32.dll


Scan Entire Drive or Disk for Issues (chkdsk)

The Check Disk command is a more impressive version of the Scan Disk command. With this command you can scan an entire disk for issues and repair them automatically.

The base use of the Check Disk command is chkdsk C: /F which stands for fix any corrupted files. It is important to note that when you run this scan, it will count any currently opened files as errors as well. This means it’s best to check the disk when booting up the PC with nothing open yet.

You should be aware that checking the disk can last a very long time depending on the number of files and your processing power. It’s also good to note that you can’t do anything or modify files on the disk being scanned, so it’s best to let then scan run and not touch the system while it’s running.

Here are some of the more useful parameters that can be used with the chkdsk command:

Parameter
(Usage: chkdsk /parameter)
Explanation
/F Fix any errors on the disk
/R Recover any bad sectors and recover readable information
/X Makes the specified disk dismount first, closing all open files and processes running from it
/C Skip checking for corrupt folders, only check files
/scan Run a scan online, checking for fixes on issues from the internet
/scan /perf The perf parameter can only be used alongside scan to perform the scan a lot faster.
This can slow down all other processes on the system during the scan.
/sdcleanup Cleans up unnecessary security descriptor data from storage

Find and Kill Any Running Task (tasklist | taskkill)

You can use the tasklist command to see all currently running tasks on your system, similar to the Task Manager. It might be somewhat redundant due to the simplicity of the Task Manager, but it can show some tasks that are not otherwise visible as well as the memory usage in a cleaner format, within command prompt.

If you wish to force-close a process, you should first take note of the name or process ID (PID) from the task list. Once you have decided on one, you can type either taskkill /im AppName to close an application by name or by typing taskkill /pid processID to kill it by its ID.

In some cases, this can be useful, for example if you want to make a batch script to close certain processes automatically when you start playing a game or boot up your machine. There are also plenty of additional parameters to be used with tasklist to sort it in a fashion you prefer.


Command Prompt Shortcut Keys

Here are the best and most useful keyboard shortcuts for command prompt. These will definitely speed up your performance with the command prompt and you can always return to this table for a quick refresher.

Shortcut Explanation
Up/Down arrow key Select the previous/next commands you’ve previously executed.
Right arrow key Repeat the previous command you’ve executed one character at a time.
Ctrl + Right/Left arrow key Move the marker before the first character of the next or previous word.
Ctrl + Up/Down arrow key Scroll up or down on the command prompt without moving the marker.
Ctrl + A Select all written text on the current row and press the combination again to select everything within the cmd.
Shift + Right/Left/Up/Down arrow key Increase the amount of text currently selected by one character left/right, or a full row up/down.
Ctrl + C / Ctrl + V Copy / Paste text to and from the command prompt. Copying requires text to be selected first.
Ctrl + Backspace Delete the word left of the marker.
Escape (Esc) Delete the entire row of text.
F1 Repeat the previous command you’ve executed one character at a time.
F2 Repeat a portion of the previous command up to a specified number (or all of it).
F3 Repeats the entire previous command.
F4 Deletes a command up to a specified number (or all of it).
F5 Repeats the last command without cycling more previous commands.
F6 Pastes “^Z” to the current row.
F7 Gives you a list of previously executed commands.
F8 Repeats previously executed commands in a cycle (keep pressing for more).
F9 Allows you to paste a previously executed command from the list (list obtained from F7).

Edit the Look & Colors of Command Prompt

Now that you know all the good stuff there is to know about the Windows cmd, it’s time to customize it a little bit. There are a few commands available for customization. You can do things like change the font or background colors, title of the command prompt window and change the font itself.

Changing the title of the command prompt is quite a useless command unless you are creating scripts and want to showcase your name or company in it. The command doesn’t save the title after the prompt is closed. However, you can change it to whatever you want by simply typing title TechTipVault.com Command Prompt or whatever name you wish.


Change Background & Font Color

First and foremost, let’s figure out how to change the font and background colors. Thankfully it’s extremely simple as all you need to do is type color and 1 or 2 color codes.

The first character in the parameter is the background color and the second character is the font color. If you only enter one character, it will change the font color and the background will default to black.

So, if you wanted a red font and a bright white background, you could type color F4. To change the color scheme back to the default options, type in color without any parameters.

Command Prompt Color Codes Red Colour Scheme Command Prompt

Change the Font Style

In order to change the font used in cmd, you need to first access the properties of the window. You can do this by right-clicking on the title bar of the command prompt and selecting Properties.

Once opened, you might notice you can also change the above colors there as well, but the most useful tab is the Font tab. The options there are very self-explanatory. At the top you can choose your font-size and below it you can pick a font family of your choosing.

Changing Font In Command Prompt

You can also tick the Bold fonts checkbox to bold all fonts and you can see the preview of what your selection will look like at the bottom.

Now that you’ve read through the entire guide, you should have a firm grasp on the functionality of the Command Prompt. There’s tons of parameters and commands not covered in this guide, as it would become way too cluttered and hard to read. We highly recommend you go through all the command manuals within cmd and try as many of them out yourself to understand how they work in-depth.

If you noticed any issues with the contents or think we should add some clarifications, don’t hesitate to contact us. You can find our contact details on our About Us page.

Windows Prompt Command 2023 Blog

Today, most users ignore the Windows Command Prompt, as we can perform just about anything using the graphical interface. It’s easier, right? Well, why does Windows keep its prompt, then?

Although it’s almost 50 years old, it is not outdated. On the contrary, it’s very popular, and many find it incredibly useful. It has stood the test of time, so its existence is a sufficient reason to get familiar with it. It is the best way to perform many tasks, even in the modern age. Moreover, it’s pretty easy to use.

So, let’s get right to it! We’ll explain the basics of the command prompt Window, teach you how to open the Windows prompt command line, and give you a cheat sheet of the most popular CMD commands and what they do in more detail.

    • What Is Windows Command Line?

      • History of CMD Commands
    • Why Would You Use The Command Prompt?
    • How To Open the Windows Command Line?
    • How To Use the Windows Command Line?
    • Windows Command Prompt Cheat Sheet

      • Basic Commands
      • Files & Folders Commands
      • Disk & Partition Commands
      • Network Commands
      • System Information & Configuration Commands
    • How To View Your Command Prompt Window History?
    • The Next Step: Windows PowerShell

      • Windows Command Prompt vs. Windows PowerShell

        • Command Prompt:
        • PowerShell:
    • Conclusion

What Is Windows Command Line?

A command prompt or prompt is a command-line interface (CLI), a text-based user interface (UI) that enables you to perform various tasks within an OS or a program. For instance, you can interact with your computer, manage files and directories, run programs, script, automate, or perform other basic and advanced tasks.

Some operating systems provide you with a CLI exclusively, while others might grant you both a CLI and a GUI.

The Command Prompt or cmd.exe is the default command-line interpreter in Microsoft Windows, OS/2, eComStation, ArcaOS, and ReactOS operating systems. More precisely, it executes the commands you input in the Windows OS, like Terminal on macOS and Shell on Unix-based systems.

Both CLIs and GUIs are shells, programs that enable you to give commands to the computer. However, a CLI differs from a GUI, as the Graphical User Interface allows you to interact with the system using graphical elements, such as icons or menus, instead of text.

History of CMD Commands

Text-based commands go back to the existence of the Windows PC. Users could operate early Windows operating systems exclusively through CLIs; they didn’t have the mouse cursor or similar GUI elements.

Question: When did the CMD commands become available?

Answer: The Windows Prompt became available in December 1987. Virtually, Microsoft hasn’t changed its design since then. Yet, we officially recognize them as CMD commands in Windows 10, 8, 7, Vista, and XP.

The commands in earlier versions, including Windows 98/95, were known as DOS commands. Up to the 2000s, Windows versions included the MS-DOS integration, and clients ran commands using the MS-DOS Prompt. Later, starting with Windows XP in 2001, it was renamed Command Prompt.

Why Would You Use The Command Prompt?

Many customers haven’t even touched the Windows Command Prompt because modern, streamlined operating systems remove the need for old-school text commands. And sure, it might feel inconvenient to perform some tasks, such as managing files and folders using the command line, especially if you are used to the GUI.

Still, the command line is incredibly handy for many tasks, such as checking your IP address. Moreover, while it works at a basic level, the CMD is, in reality, the more powerful alternative.

It translates dozens of clicks in the GUI into a single line, thus shortening the time it takes to execute a new task. Power users also prefer it because it grants them more control over their computers and establishes direct communication.

Using the command window, you can perform advanced tasks, such as creating shortcuts to pin to the taskbar, accessing vital information, managing security issues, or fixing faults in Windows. Moreover, you can access parts of the operating system that are unavailable through the graphical user interface.

Last but not least, some of these commands apply to Linux, macOS, and many other operating systems, not only the Windows environment. So, learning them once may also benefit you in the future, even if you switch to another OS.

How To Open the Windows Command Line?

You can open the Command Prompt in Windows in a few ways:

  • Start Menu > Type “command prompt” > Press Enter

A screenshot from Windows PC displaying how to open the command prompt from the start menu.

  • Start Menu > Type “cmd” > Press Enter

A screenshot from Windows PC displaying how to open the command window from the start menu.

  • Press Win + R > Type “cmd” > Press Enter

A screenshot displaying how to open ports from the Run command dialog box on a Windows.

  • Right-click the Start Menu > Choose Command Prompt

  • Press Win + X > Choose Command Prompt

The Command Prompt in the Start Menu might also appear as Windows PowerShell or Windows Terminal, depending on your Windows settings. Both are more powerful yet compatible with CMD commands.

A screenshot of the Start Menu on a Windows, displaying the PowerShell option and clipboard-related topics.

Yet, remember that some commands require administrator access. To open a command prompt and perform some of the commands, make sure to choose the Admin option from the menu. For the other ways to open the CMD, hold Ctrl + Shift to get admin permission when you launch.

How To Use the Windows Command Line?

As soon as you open the command prompt, you’ll immediately learn a lot.

The first line shows you your Windows version. In my case, that’s 10.0.19045.2486. Also, pay attention to the third line, i.e., C:\Users\[Username]>. It refers to the Windows user and tells you where your commands will take place if CMD relies on location. Some CMD commands, however, are general. So, your location won’t matter.

A screenshot as an example of the command window.

Question: How many commands are there in CMD?

Answer: While the exact number of commands differs according to your Windows version, you can use approximately 100 commands.

The commands are not case-sensitive. Yet, as you are issuing them directly, try to type in the command correctly. Otherwise, the system won’t be able to understand you. But worry not; you cannot do much harm with a typo. If Windows doesn’t recognize the command, you’ll get a message saying: ‘[Command]’ is not recognized as an internal or external command, operable program, or batch file.

An example of a typo and the error message in an open command prompt.

However, typing the wrong command sure does some damage. If Windows recognizes the command, it will execute it immediately. So, it would be best to take your time and double-check everything. Moreover, avoid using the admin Command Prompt unless necessary.

Windows Command Prompt Cheat Sheet

Finally, we come to the most used commands in Windows OS. You can keep the list open on your desktop or print it; either way, keep it near to make the most out of CMD without feeling overwhelmed.

Basic Commands

Even if you have never used the command prompt window, some of its commands are welcoming to beginners.

Here’s a quick summary to help you start with the basics and build your knowledge:

  • Any command/?: Gives you information about the specific command and what it does

  • ARROW DOWN: Enables you to move forward in history toward the most recent command

  • ARROW UP: Enables you to step through the last called commands from the most recent one

  • call: Tells batch programs from one another

  • cd (change directory): Displays the name of or changes the current directory

  • chkdsk: Scans a disk for errors and delivers a status report

  • cls: Clears the contents of the Command Prompt

  • color: Applies the default console colors

  • Ctrl+A: Moves the caret to the beginning of the line

  • Ctrl+C: Cancels a command you are running

  • Ctrl+E: Moves the caret to the end of the line

  • Ctrl+K: Deletes all characters after the caret

  • Ctrl+L: Clears the screen

  • Ctrl+U: Deletes all characters before the caret

  • date: Displays or sets the date

  • del [file name]: Deletes the selected file

  • dir (directory): Lists all the files and subdirectories in the directory you are currently in

  • echo: Presents messages or turns command-echoing on/off.

  • exit: Quits the current echo setting or the CMD.EXE program

  • find: Searches for a text string in one or multiple files

  • help: Lists many common commands you can use

  • hostname: Prints the name of the current host

  • ipconfig: Provides a network overview for your current connection

  • mkdir [new folder name] (make directory): Creates a new folder

  • pause: Suspends processing of a batch program and displays the message

  • ping: Checks if your computer can reach a remote destination and how long it will take

  • prompt: Specifies a new command prompt

  • rmdir [folder name] (remove directory): Deletes an entire folder if it’s empty

  • sfc: Windows detects and fixes corrupt system files *you need admin access

  • TAB: Autocompletes what you have been writing

  • title: Sets the window title for the command prompt window

Once you get familiar with the basics, it’s time to take your skill to the next level. Let’s overview the most popular CMD commands for different tasks on Windows.

Files & Folders Commands

  • assoc: Displays or modifies file extension associations

  • attrib: Displays or changes file attributes

  • comp: Compares the contents of two files or sets of files

  • compact: Displays or alters the compression of files on NTFS partitions

  • expand: Expands one or more compressed files

  • fc: Compares two files or sets of files and displays their differences

  • find: Searches for a text string in one or multiple files

  • findstr: Searches for string patterns in files

  • md: Creates a directory

  • move: Moves and renames files and directories

  • openfiles: Lists or disconnects files and folders opened on a system *you need admin access

  • print: Prints a text file

  • ren (rename): Renames one or multiple files

  • replace: Replaces files

  • robocopy: Creates robust file copy for Windows

  • tree: Graphically displays the selected folder structure of a drive or path

  • type: Displays the contents of one or more text files

  • xcopy: Copies files and directory trees

Disk & Partition Commands

  • chkdsk: Checks a disk and displays a report

  • chkntfs: Displays or modifies the checking of the disk at boot time

  • convert: Converts a FAT volume to NFTS

  • format: Formats a disk for use with Windows

  • label: Creates, changes, or deletes the volume label of a disk

  • recover: Recovers readable information from a bad or defective disk

  • vol: Displays the disk volume label and serial number, if they exist

Network Commands

  • arp: Displays and modifies the IP to physical address translation tables used by ARP (Address Resolution Protocol)

  • bitsadmin: Creates, uploads or downloads jobs and monitors their progress

  • ftp: Transfers files to and from a computer running an FTP server service

  • ftype: Displays or modifies file types used in file extension associations

  • netsh: Configures, controls, and displays network components

  • netstat: Displays protocol statistics and current TCP/IP network connections

  • route: Manipulates network routing tables

  • systeminfo: Displays OS configuration information for a local or remote machine, including service pack levels

System Information & Configuration Commands

  • driverquery: Enables you to display a list of installed device drivers *you need admin access

  • powercfg: Enables you to control power settings on a local system

  • shutdown: Turns off computer

  • time: Displays or sets the system time

  • ver: Displays the Windows version

If you want to run multiple commands, combining them instead of waiting for them to complete one after another will save you a lot of time. To combine commands, separate them with a semicolon (;) on the same line.

Moreover, you can use the ‘only if’ option. You can link the command to its predecessor. If the command follows ‘&&,’ it will complete only if the previous command is completed successfully as well. On the contrary, if the command follows ‘||,’ it will complete only if the previous command has failed.

And if this is not enough and you want to take your knowledge on related topics to the next level, visit the official Microsoft page for a list of all commands with detailed explanations in alphabetical order.

How To View Your Command Prompt Window History?

One of the main disadvantages of the Command Prompt is that it only records data from the active session. So, if you have performed commands and rebooted your computer, in theory, you will be unable to review what you have done.

Fortunately, there are a few hacks, and we’ve decided to include them as extras in our Windows command prompt cheat sheet.

First, you can use the keyboard shortcut:

  • Open a command prompt

  • Run commands

  • Press the F7 key

  • Check the list of recent commands

  • Press the one you want to execute again

  • Hit enter

Second, you can search the command history:

  • Open a command prompt

  • Execute commands

  • Press the F7 key

  • Check the list of recent orders

  • Press the F8 key

  • Type what you remember from the line

  • Press the F8 key again

  • If you don’t like the result, press the F8 key again to view another entry

Next, you can use the doskey:

  • Launch the Prompt

  • Type doskey/history

It will enable you to recall previously typed commands, edit command lines, or even create macros.

Last but not least, you can export your prompt history to file:

  • Run the CMD as an Administrator

  • Type doskey /h > c:\cmd_history.txt

  • Change the c:\cmd_history.txt to represent the file path and name you want to export your current history to

The Next Step: Windows PowerShell

PowerShell is an alternative to the Windows Command Prompt. It consists of a command-line shell, a scripting language, and a configuration management framework and is compatible with Windows, Linux, and macOS.

Question: When was PowerShell released?

Answer: Microsoft released PowerShell 1.0 in November 2006 for Windows XP SP2, Windows Server 2003 SP1, and Windows Vista.

Initially, the company released PowerShell as an optional component with many useful commands, known as cmdlets. Their goal was to integrate the cmdlets better with their offerings, for them to batch files and VB scripts.

But, just recently, the company also announced that PowerShell is replacing the CMD.EXE. Fortunately, you can still use the Command Prompt if you prefer.

Windows Command Prompt vs. Windows PowerShell

PowerShell is the more advanced and the latest version of the Command Prompt. It enables you to execute more or less the same commands as CMD. At the same time, it facilitates carrying out administrative tasks.

Let’s review a few of their differences briefly so that you can understand both applications better.

Command Prompt:

  • Works with Batch commands exclusively

  • You cannot create aliases for commands

  • You cannot pass the output from a command on to other commands

  • Output comes out in the form of text

  • No separate ISE

  • Requires an external plugin for WMI interaction

  • It doesn’t support Linux OS

  • You can only run console-type programs

  • It cannot connect to Microsoft cloud products

PowerShell:

  • Works with Batch commands and PowerShell cmdlets

  • You can create aliases for cmdlets or scripts

  • You can pass the output from a cmdlet on to other cmdlets

  • Output comes out in the form of an object

  • Has a separate ISE

  • It can integrate directly with WMI

  • Fully supports Linux OS

  • You can run all types of programs

  • It can connect to Microsoft cloud products

So, which one should you learn? It depends on your needs. PowerShell is a relatively new product. It is easy to interpret, provides more compatibility and options, and you can expect a lot of advancements promptly. On the other hand, you can perform most of the tasks using the old-school and all-timer CMD.

Conclusion

While an unpopular opinion, the CMD is, in fact, much more powerful than a GUI. Better yet, it’s not only intended for experienced or advanced users. It’s quite the contrary. The Windows prompt is equally suitable for newcomers, as it’s time-efficient and easy to use.

The bottom line is that learning about the Windows command prompt is worth it. And our Windows command prompt cheat sheet is the perfect place to start and get the most out of your Windows experience!

  • Windows cannot find make sure you typed the name correctly and then try again перевод
  • Windows cannot find google chrome
  • Windows cannot find bin javaw
  • Windows cannot copy files required for installation
  • Windows command line command time