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.
powershell start cmd -v runAs
– Run the Command Prompt as an Administrator
Entering this command opens another command prompt window as an administrator:
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.
chdir
or cd
– Changes the Current Working Directory to the Specified Directory
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.
set
– Shows your PC’s Environment Variables
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
:
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.
You can type clip /?
and hit ENTER
to see how to use it.
assoc
– Lists Programs and the Extensions They are Associated With
title
– Changes the Command Prompt Window Title Using the Format title window-title-name
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”
.
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.
netstat -an
– Shows Open Ports, their IP Addresses and States
ping
– Shows a Website IP Address, Lets you Know How Long it Takes to Transmit Data and a Get Response
color
– Changes the Text Color of the Command Prompt
Enter color attr
to see the colors you can change to:
Entering color 2
changes the color of the terminal to green:
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
ipconfig
– Shows Information about PC IP Addresses and Connections
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
.
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.
For example, you can use powercfg /energy
to generate a battery health report.
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
del
– Deletes a File
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
.
start website-address
– Logs on to a Website from the Command Line
tree
– Shows the Tree of the Current Directory or Specified Drive
ver
– Shows the Version of the OS
tasklist
– Shows Open Programs
You can do the same thing you do with the task manager with this command:
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
:
date
– Shows and Changes the Current Date
time
– Shows and Changes the Current Time
vol
– Shows the Serial Number and Label Info of the Current Drive
dism
– Runs the Deployment Image Service Management Tool
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
echo
– Shows Custom Messages or Messages from a Script or File
You can also use the echo
command to create a file with this syntax echo file-content > filename.extension
.
mkdir
– Creates a Folder
rmdir
– Deletes a Folder
N.B.: The folder must be empty for this command to work.
more
– Shows More Information or the Content of a File
move
– Moves a File or Folder to a Specified Folder
ren
– Renames a File with the Syntax ren filename.extension new-name.extension
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.
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.
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
В этой статье мы покажем вам 40 операций, которые можно использовать в командной строке Windows. Они помогут вам стать более уверенным пользователем.
Операции в командной строке Windows
powershell start cmd -v runAs – запускает командную строку от имени администратора. Ввод этой команды откроет новое окно командной строки с правами администратора.
driverquery – отображает все установленные драйвера. Важно иметь доступ ко всем драйверам, так как они часто вызывают проблемы. Эта команда показывает даже те драйверы, которые не отображаются в диспетчере устройств.
chdir или cd – меняет текущий рабочий каталог на указанный каталог.
systeminfo – показывает информацию о вашем ПК. Эта команда предоставляет подробную информацию о системе, которую нельзя увидеть в графическом интерфейсе.
set – показывает переменные среды вашего компьютера.
prompt – меняет текст, отображаемый перед вводом команд. По умолчанию командная строка показывает путь к диску C. Вы можете изменить этот текст с помощью команды prompt с синтаксисом: prompt имя_подсказки $G.
Примечание: если не добавить $G к команде, символ «>» не появится перед текстом.
clip – копирует элементы в буфер обмена. Например, dir | clip копирует содержимое текущего каталога в буфер обмена. Можно ввести clip /? и нажать ENTER для получения инструкций.
assoc – отображает программы и связанные с ними расширения файлов.
title – меняет заголовок окна командной строки с помощью команды: title имя_заголовка
fc – сравнивает два файла. Эта команда полезна для быстрого выявления различий между двумя файлами. Пример: fc «путь_к_файлу1» «путь_к_файлу2».
cipher – очищает диск и шифрует данные. Удаленные файлы остаются доступными.
netstat -an – показывает открытые порты, их IP-адреса и состояния.
ping – вычисляет IP-адреса сайта и время передачи данных.
color – меняет цвет текста командной строки.
Ввод команды color 2 покажет доступные цвета.
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 – показывает все пароли Wi-Fi.
ipconfig – выдает информацию об IP-адресах и сетевых подключениях. Команда имеет расширения, например: ipconfig /release, ipconfig /renew, ipconfig /flushdns для устранения проблем с интернет-соединением.
sfc – проверяет системные файлы. Команда сканирует и исправляет поврежденные файлы. Используйте расширение /scannow для запуска проверки.
powercfg – меняет настройки питания. Команда имеет несколько расширений. Вы можете ввести powercfg help, чтобы показать эти расширения.
Например, powercfg /energy создает отчет о состоянии батареи в виде HTML-файла, который можно найти по пути: C:\Windows\system32\energy-report.html.
dir – показывает содержимого каталога.
del – удаляет файлы.
attrib +h +s +r имя_папки – скрывает папки. Для отображения папки используйте команду: attrib -h -s -r имя_папки.
start адрес_сайта – открывает сайт из командной строки,
tree – показывает структуру текущего каталога или указанного диска.
ver – отображает версиию ОС.
tasklist – показывает открытые программы.
taskkill – завершает выполнение задачи. Для завершения задачи выполните команду: taskkill /IM «task.exe» /F. Пример: taskkill /IM «chrome.exe» /F.
date – показывает и меняет дату.
time – показывает и меняет время.
vol – выдает серийный номер и информацию о метке текущего накопителя.
dism – запускает средство управления службой образов развертывания.
CTRL + C – прерывает выполнение команды.
-help – выдает справку по командам.
echo – показывает пользовательские сообщения или сообщения из сценария, файла.
Пример создания файла: echo содержимое_файла > имя_файла.расширение.
mkdir – создает папку.
rmdir – удаляет папку. Помните, папка должна быть пустой для успешного удаления.
more – показывает дополнительную информацию или содержимое файла.
move – перемещает файл или папку в указанный каталог.
ren – переименовывает файл. Пример: ren имя_файла.расширение новое_имя.расширение.
cls – очищает командную строку.
exit – закрывает командную строку.
shutdown – завершение работы, перезагрузка, перевод в спящий режим.
Для просмотра доступных опций введите shutdown в командной строке. Например, shutdown /r перезагрузит компьютер.
В итоге
Эта статья познакомила вас с несколькими командами, которые позволяют получить доступ к скрытым функциям вашего ПК. Будьте осторожны при работе с ними, так как они могут оказать длительное воздействие на вашу операционную систему.
Windows Command Line
A simple guide for any skill level.
Windows Command Line, known as a Command Line Interface, can be a very powerful tool for system administrators, power users, and technical support personnel. While most users will never see Windows Command Line, this guide is intended for Intermediate to Advanced users.
Most of Windows Command Line functions can be accessed through Windows GUI, other functions and programs can not. Knowing and understanding Windows Command Line will allow you to complete tasks faster, access features and programs not available in the Windows GUI, and look like you know what you’re doing.
Through this guide, we will walk through each section of commands that Windows XP Command line offers you the capability of. At the end, we discuss how scripting, and batch files can automate tasks, and save you time.
Terms:
CLI — Command Line Interface (non-GUI)
WCL — Windows Command Line
GUI — Graphical User Interface
Script — Chain of commands to be automatically run in order
Navigating Windows Command Line
To open Windows Command Line, click Start > Run and enter the word «cmd». This is a shortcut to opening a historic file called command.com, which is now called cmd.exe (the main program running WCL). The files for WCL can be found in «%systemroot%\system32». Whenever you see a value starting and ending with %, you will know this is a variable. The %systemroot% variable will have a value of whatever your main windows folder is. For Windows XP, your system root is C:\Windows\, unless specified otherwise. For Windows 2000, your system root is C:\Winnt.
Terms:
Variable — A value that can change based on user input
Syntax — The way a command is typed (word order)
Navigating the Command Line Interface: Commands and Examples
Each command in Windows Command Line has a different function. Each command also has a help document associated with it (for the most part). To access help for any command, try these two methods:
Windows Command Line Help
(command) /? — This /? at the end of the command will bring up a help document describing different «modifiers» you can add to command using the / symbol.
If you dont get a help document from the first command, check your syntax, and try the other help command.
HELP — Help document for WCL
Usage: help OR help <command>
Example: help
Example: help copy
Explanation: Help lists commands, help <command> shows command help document
Windows Command Line Commands
Listed below are some commonly used Windows Command Line Commands. They show the command name, its description, usage, and an explanation of what the example command would do.
CD — Change current working directory
Usage: cd <directory you want to open> OR cd\
Example: cd\
Explanation: Changes your working directory to root (c:\)
Example: cd windows
Explanation: Takes you to the windows directory inside your current directory
COPY — copies files or folders to other locations that already exist
Usage: copy <file or folder from> <copy file or folder to>
Example: copy employees.txt c:\work\employees\
CLS — Clears the screen of all commands
Usage: cls
Example: cls
DEL — Deletes a file from current directory
Usage: del <folder or file name>
Example: del programs
Explanation: Deletes the folder or file named programs
DIR — Used to list all files in current directory
Usage: dir (modifiers can be listed with /?)
Example: dir
Explanation: This will list all files and folders at current location
EXIT — Exits CMD
Usage: exit
FIND — Finds a command given certain search parameters
Usage: Find <search term>
Example: Find «*.txt»
Explanation: Finds all text files in directory
Notes: * can be used as a ‘wildcard’ to mean any length or any combination of letters.
MD — Make directory at current location
Usage: md <directory name you want to make>
Example: md programs
Explanation: This will make a new folder at the current location
MOVE — Moves a file from one location to another (cut)
Usage: Move <full path of file you want to move> <already existing directory to move TO>
Example: Move c:\games\mygame.zip c:\newgames\
Explanation: This will move the file mygame.zip from one directory, to another existing directory
PAUSE — Pauses scripts or batch files and waits for user input
example: pause
Explanation: When in a script, this displays «Press any key to continue» and waits for user input
RD — Remove Directory
Usage — rd <folder name>
Example: rd windows
Explanation: This removes the directory Windows (bad idea)
Notes: to remove a directory and its contents, «rd /s windows»
REN — Rename a folder or file
Usage: ren <file or folder> <new name you want>
Example: ren windows window
Explanation: this changes your windows directory name to window
TIME — Check or modify system time
Usage: time
VER — Check your version of Windows
Usage: ver
Windows Command Line also interfaces with files on your computer to record data to. Piping and chaining commands is another option in most CLI situations. Chaining commands is simply feeding the output of one command (dir for example outputs a list of files and folders) to another command that you want to run only for the output of the first file.
Piping Commands
The chaining of commands can be used by typing | (shift + \). This is called the pipe, or piping commands. To pipe one command to another, type one full command, and WCL automatically outputs the data that you normally see to the next command.
For example, «dir c:\windows\ | Find «*.txt»
The above example would list all files in c:\windows\ then put all of the files and folders in c:\windows\ get sent to the find command. The find command then looks for any files that end in .txt. You will now see a list of all txt files in c:\windows\
Output to a text file
Another useful function for script makers is the ability to output text from the command line (input and output) to a text document. Using the output to text file, or append options both come in handy at different times.
> — Create a new text file and have WCL output info to it
Usage: <command to output> > <location of text file to output to>
Example: dir > c:\myfiles.txt
Explanation: This command would list all files and folders in current directory, and outputs to file c:\myfiles.txt
>> — Append information from a command to a text document.
Usage: <command> >> <file to add to>
Example: dir > c:\myfiles.txt
Explanation: This would list files and folders in current directory and ADD the list to myfiles.txt while keeping the previous data in tact.
Chaining Commands
When there are multiple commands you want to run at one time, Chaining commands in Windows Command Line comes in handy. To chain a command, we have two tools.
& — Complete one command then another directly after
Usage: command & command2
Example: dir & ver
Explanation: This will list all files in current directory and then the version of Windows Command Line
&& — Complete one command, then another if the first was successful
Usage: <command1> && <command2>
Example: copy c:\importantdata.txt c:\backup\ && ren backupdata.txt
Explanation: This will copy the file importantdata.txt to c:\backup\, THEN if successful, it will rename the file to backupdata.txt
Processes and Performance
Windows has its GUI version of system performance monitor that shows up every time you press CTRL-ALT-DELETE at the same time. There is also a command line version that can be configured to show much more information for power users.
Another thing to take into account is that when you open a CMD window, it will use a LOT less system resources than a GUI. This can be VERY helpful in ending processes that are lagging your computer a lot.
To access the process and performance monitoring tools, use the following commands:
TASKLIST — Lists all running processes with detailed information
Usage: Tasklist
Note: the /svc addition to tasklist allows you to see what processes are using what services at the moment
Note2: /M addition shows each process, and associated DLL files
TASKKILL — Stops tasks with given parameters
Usage: Taskkill <which task>
Example: Taskkill /pid 140
Explanation: This will end the task with PID of 140 (the process identification number). You can find the PID for each task using tasklist
Controlling Windows Services in Command Line
Services are extra functions that Windows has the ability to start and stop depending on whether you allow the services to be started. A lot of windows services contribute to slow computing, security risks, and instability in the operating system. While some services are essential, others are never needed. Windows XP Services
To list, modify, start and stop services you will need a new commands to help you.
SC query — Shows list of configured services
Usage: SC query
Explanation: This will list info and data on services
SC qc — Queries a specific service
Usage: SC qc <service name>
Example: sc qc messenger
Explanation: This will show configuration data for the messenger service
SC start — Starts a specific service
Usage: SC start <service name>
Example: SC start messenger
Explanation: This starts the messenger service
SC stop — Stops a specific service
Usage: SC stop <service name>
Example: SC stop messenger
Explanation: This stops the messenger service
SC config — Configures service properties
Usage: SC config <service name> start= <start type>
Example: SC config messenger start = disabled
Explanation: This will tell the messenger service NOT to start with the computer.
Notes: Settings available for start= are Disabled, Auto, and Demand
Disabled never starts, Auto starts every startup, and demand starts as the service is needed
Windows Hard Disk Utils
Windows comes with extensive command line utilities to control, check and maintain your hard disk drives. Included in the utilities are Drive Partitioners, Defragmenters, Check Disk Utilities, and utilities to set a drive to be checked for errors on next startup.
Try some of these Windows Command Line Commands, as they can save your computer in case of disasters like virus’s or improper shutdowns.
CHKDSK — Checks a hard disk for errors
Usage: chkdsk <parameters> <drive to check>
Example: chkdsk /f C:
Explanation: This command will scan drive C for errors, and repair them if needed.
Notes: /f parameter auto-repairs errors when found
DEFRAG — Defragments a hard drive to optimize performance
Usage: Defrag <parameter> <drive letter>
Example: Defrag c:\
Explanation: Desfragments the C: drive
Notes: defrag -a <drive letter> will analyze only, and not defragment
User Control
Embedded in Windows XP is the ability to add and remove users. This concept is called a «Multi-User Operating System». This type of system allows for more than one user account to be made, each account with specific permissions to access data or run programs. User Accounts can be changed from control panel, or Windows Command Line.
NET USER — View a list of local user accounts
Usage: Net User <name of user, or blank for all>
Example: Net User Chris
Explanation: Displays user account info for user Chris
Notes: Access to net user can be used across a single domain also
Parameters: net user <name> /delete
Explanation: This deletes a user account
NET USER — Adds users to local computer
Usage: net user <username to add> <password to add> /add
Example: net user chris library /add
Explanation: This will add a user to the local computer with the name as chris, and the password as library
Notes: Parameters that go BEFORE /add are
/fullname:»Chris Reed» (Full name of user)
/comment:»Chris is main systems admin» (users comments)
/passwordreq yes (requires password at logon)
Example 2: net user Chris library /fullname:»Chris Reed» /comment: «Chris is main systems admin» /passwordreq yes /add
Explanation: This adds user Chris with password library, and full user name of chris reed, with a user comment as «Chris is main systems admin» and requires a password at logon
Managing TCP/IP and Networking with WCL
TCP/IP is a transmission protocol for two computers communicating through a network. TCP/IP has error checking for the packets that are transferred, and is used in many internet and networking situations.
Windows Command Line allows you to view detailed information about your internet connection, DNS servers, DHCP servers, your internal IP address, and defualt gateway. The commands below will show you how to check your TCP/IP status, modify servers, and set static IP addresses.
Terms:
[code]DHCP — Automatically determined IP set for your computer
Static IP — A custom setup network configuration with unchanging IP
TCP/IP — Communication protocol for 2 computers over a network
Default Gateway — Your router or gateways IP address
Subnet Mask — Defines the section of a network you are on
DNS servers — Computer that resolves URL to IP (www.yoursite.com to IP)
IP address — Your individual computers network ID
Note: To check your TCP/IP connections, network adapter, and settings, you can type ping «127.0.0.1». This will send a ping out through your network adapter, and redirect it right back to your computer. Upon successful ping, you can tell that your computer is setup properly to use TCP/IP.
==
TCP/IP from Windows Command Line ==
IPCONFIG — Shows IP information for your computer
Usage: IPCONFIG or IPCONFIG /all
Example: ipconfig /all
Explanation: Shows all information about current TCP/IP connection
Notes: Other parameters /flushDNS (resets DNS cache) /release (releases your network adapter) /renew (renews your network adapter)
SET ADDRESS — sets tcp/ip settings via WCL
Usage: Set address name=»<connection name>» source=<static or dhcp> addr=<static IP> mask=<subnet mask> gateway=<gateway IP>
Static IP Network Configuration
Example: Set address name=»Local Area Connection» source=static addr=192.168.1.201 mask=255.255.255.0 gateway=192.168.1.1
Explanation: This will make the computer setup a new connection called Local Area Connection, with a STATIC IP of 192.168.1.201, a subnet mask of 255.255.255.0 and a gateway of 192.168.1.1
DHCP Network Configuration
Example: set address name=»Local Area Connection» source=»dhcp»
Explanation: This will setup a new connection name Local Area Connection that will try to automatically set your IP using DHCP protocol. (Your router or gateway will be the DHCP server usually)
DELETE ADDRESS — Removes a connection from your list
Usage: Delete Address name=<address name> addr=<IP address>
DNS Server Setup
DNS servers are computers connected to the internet with records of URLs (www.yoursite.com) and the matching IP address for the URLs server (68.48.0.12). Your computer connects to a DNS server every time you enter a web page in your address bar. Although you dont usually see the IP address information, it is hiding beneath your browser or internet program.
To setup custom DNS servers using WCL, you will need the following commands. For your DNS server, you can either contact your ISP, and use one of theirs, or you can try using your router.
ADD DNS — Sets custom DNS servers to use
Usage: ADD DNS name=<DNS server name> addr=<ip of DNS server>
Example: ADD dns name=»My Pinacolataburg DNS» addr=»68.48.0.12″
Explanation: Adds a DNS server named My Pinacolataburg DNS with an IP address of 68.48.0.12
DELETE DNS — removes a specific DNS entry from a connection
Usage: delete dns name=<name to delete> addr=<IP to delete>
Example: delete dns name=»My Pinacolataburg dns» addr=68.48.0.12
Explanation: This will remove the DNS server entry above
Windows Command Line has an array of tools for diagnosing network problems. You can view individual stats for network adapters and network connections. You can also view the path to a certain internet host, get ping information for the host, and find all open TCP/IP connections with information on what program is using the connection.
Tracert — Find ping, and number of hops to reach a given server
Usage: Tracert <internet host to trace the route to>
Example: tracert www.computershack.net
Explanation: This command would give tracert information from the originating computer, to the opposite end of the connection.
PING — Find how long it takes for a message to be send to a server, and back again.
Usage: Ping < internet host IP or URL >
Example: ping www.computershack.net
Explanation: Ping shows the time, in milliseconds it takes to contact the given IP or URL, plus the time it takes to get back to your computer.
NETSTAT — Shows information about network connections
Usage: Netstat <parameters>
Example: Netstat -b
Explanation: With the parameter -b, netstat shows a list of all open connections, the port, and program that is managing the connection.
Notes: Another parameter is -a to view all open connections/ports
NETSH — Network Shell is a collection of tools to diagnose network components.
Usage: NETSH <parameter>
Example: NETSH diag ping adapter
Explanation: This will ping each item in your TCP/IP configuration. Included is DNS, DHCP, WINS, and Default Gateway
Conclusion: Using the information in this document, it is possible to control, maintain, diagnose, and fix problems in almost all categories. With this information, try using Windows Command Line more often. It will help you become a better technician, and be able to fix more problems faster.
More Resources:
- Official Microsoft Command Line Reference
Last Updated :
22 Apr, 2025
Learn how to manually run the Command Prompt in different versions of Windows — The Windows Command Prompt (CMD) is a powerful tool that allows users to execute commands, automate tasks, and troubleshoot system issues efficiently. Whether you’re a beginner looking to learn basic CMD commands or an advanced user wanting to optimize your workflow, mastering the Windows Command Line Interface (CLI) can significantly enhance your computing experience.
In this step-by-step Windows Command Prompt tutorial, we’ll cover everything from basic commands like cd
, dir
, and mkdir
to advanced functions such as network troubleshooting, batch scripting, and system management. Learning CMD can help you navigate Windows faster, execute tasks more efficiently, and fix errors that may not be solvable via the graphical interface.
Follow this tutorial to unlock the full potential of Windows Command Prompt and take control of your system like a pro.
What is a Command Prompt?
The Command Prompt is a powerful tool for troubleshooting Windows and managing files. It provides a text-based interface where users can execute various system commands and configure their computer. The Command Prompt is for all levels of users who are looking to perform advanced Command Prompt techniques, CMD also opens a broad range of capabilities, from automating tasks to system diagnostics.
- What is a Command Prompt?
Getting Started with Command Prompt
Learn how to open the Windows Command Prompt and understand its basic functions. This foundational knwoledge is seesntial for navigating your system using simple command-line.
- How to Open Command Prompt in Windows 11, 10, 8, 7
- How to Open Command Prompt as Administrator?
- How to Open Command Prompt with Keyboard Shortcuts
Basic Command Prompt List
Master the essential CMD commands to manmage directories, list files and clear the screen. These commands are fundamental for effective system navigation.
- cd
- dir
- cls
Also read 39 Windows CMD Commands for Everyone
System Information
Utilize systeminfo and ipconfig commands to retrieve detailed information about your system’s configuration, including network settings and hardware specifications. This is crucial for troubleshooting and system optimization.
- System Info
- ipconfig
- ping
- tasklist
File and Directory
In this section, you’ll get to know how to list all files in directories, search files using CMD, and will also allow you to create, manage and delete files and folders.
- List all Files in a Directory
- Search files
- mkdir
- Rename (files and folders)
- del
- Hide
- Compress (files and folders)
- copy
- Xcopy
- move
Networking and Connectivity
Diagnose and configure network settings with netstat, ping and tracert commands. These tools help you to test network connections, check network routes, and troubleshoot connectivity issues in your Windows system.
- netstat
- Check Open Ports
- tracert
- ftp
- Telnet
- nslookup
System Utilities
Maintain and repair system files using sfc and chkdsk commands. These built-in prompts are essential to ensure that you can make the most out of it.
- Difference Between SFC, CHKDSK, and DISM
- Chkdsk
- Repair
- sfc
- Diskpart
Advanced Commands
In this section, you’ll get to know some of the advanced CMD commands and functionality to automate your system tasks so that you can manage and perform any complex tasks with ease.
- Powershell
- Abort Command Execution
- Regedit
- Shutdown
- CMD Commands to Gather Information of a System
Customization
Personalize your Command Prompt experience by changing its font, text, creating batch file, Wi-Fi Hotspot, and Install program. These commands will enhance and make your experience seamless.
- Color cmd command
- Change text colour
- How to Clear the Windows Command Prompt Screen
- Setting up custom batch file
- Create a Wi-Fi Hotspot
- Merge/Hide One File into Another
- Copy files from one Directory to another
- Personalize Environment
- Hide text behind text
- Install Program
- Install Chocolatey
- Install Specific Version using Chocolatey
- Uninstall Software
Common Troubleshooting
You can use CMD troubleshooting commands like bootrec, bcdedit and sfc to diagnose and fix boot issues, repair corrupt files, and resolve system errors.
- Scannow
- Bootrec
- Bcdedit
- Remove Virus
- Show Previously Connected Wi-Fi Devices
- How to Repair Windows Common Errors Only With CMD
Command Prompt Tips and Shortcuts
Enhance your productivity with CMD Keyboard Shortcuts such as Ctrl + C (to stop process), Ctrl + Z (undo), or F7 to check the command history. These shortcuts enahnce users to navigate moe efficiently.
- Keyboard shortcuts
- Change and Customize Keyboard Shortcuts
- Command Prompt Hacks
- Useful CMD Commands for Daily Usage
- 26 Useful CMD Commands for Everyone
- Remotely Start Windows
- How to Run an exe through CMD
Command Prompt Real-Life Use Cases
In this section, you’ll get to know about how CMD commands can work as a charm in real-life scenarios. Whether you are looking to automate any task, or schedule it for later, you can do it all by just using the Windows Command Prompt.
- Automate tasks using CMD
- Change Windows Password
- Manage Network configuration
- Basic Scripting with batch files
The Windows Command Line, often referred to as the Command Prompt or CMD, is a powerful tool available within Microsoft Windows that allows users to execute commands, run scripts, and interact with the operating system in ways that may not be readily available through the graphical user interface. Despite the growing prevalence of graphical interfaces in computing, the command line remains an essential resource for system administrators, developers, and power users alike. This reference guide aims to provide a comprehensive overview of the Windows Command Line, including its features, commands, and best practices.
The Command Line Interface
The Command Line Interface (CLI) provides a means to interact with the operating system through text-based commands. Unlike graphical user interfaces that rely on visual elements such as windows, icons, and menus, the CLI requires users to input commands in specific formats. This can facilitate more granular control over the operating system, enabling users to perform a broad range of tasks efficiently.
Opening Command Prompt
To access the Command Prompt in Windows, you can follow several methods:
-
Using the Search Feature: Click on the Windows Start button and type «cmd» or «Command Prompt» in the search bar. Press Enter to open it.
-
Run Dialog: Press
Windows + R
to open the Run dialog. Type «cmd» and press Enter. -
Context Menu: In Windows 10 and later, you can right-click the Start button or press
Windows + X
, and select «Windows Terminal» or «Command Prompt» from the context menu. -
File Explorer: Navigate to a folder in File Explorer, type «cmd» in the address bar, and hit Enter. This will open Command Prompt at that specific directory.
Navigating Directories
Once in the Command Prompt, users often need to navigate the file system. The following commands are pivotal for directory management:
-
cd
(Change Directory): Changes the current directory to the specified path.cd C:Users
-
dir
: Lists the contents of the current directory. You can also use options such as/p
(pause after each screen) and/w
(wide format).dir /p
-
mkdir
(Make Directory): Creates a new directory.mkdir NewFolder
-
rmdir
(Remove Directory): Deletes an empty directory.rmdir OldFolder
File Management Commands
File management is one of the most common tasks performed in Command Prompt. The following commands help users manipulate files:
-
copy
: Copies files from one location to another. You can also use/y
to overwrite without prompting for confirmation.copy source.txt destination.txt
-
xcopy
: A more powerful version ofcopy
, which can also copy directories and subdirectories.xcopy source destination /s
-
move
: Moves files or directories from one location to another.move file.txt D:Backup
-
del
(Delete): Deletes one or more files. It can also accept wildcard characters.del *.txt
System Commands
The Command Prompt can also be used to perform various system-level commands:
-
ipconfig
: Displays the IP configuration for all network adapters.ipconfig /all
-
ping
: Tests connectivity to a specified host. This is useful for troubleshooting network issues.ping google.com
-
tasklist
: Displays a list of all currently running processes.tasklist
-
taskkill
: Terminates a process by its ID or name.taskkill /f /pid 1234
Disk Management
Managing disks and partitions is also possible through the Command Prompt using specific commands:
-
diskpart
: Opens the Disk Partition utility, allowing users to manage disks, partitions, and volumes. -
chkdsk
: Checks a disk for errors and repairs them. It can operate in read-only mode or can attempt repairs.chkdsk C: /f
-
format
: Formats a disk for use with the Windows operating system. Care should be taken, as this deletes all data on the drive.format D: /fs:NTFS
Networking Commands
The Command Prompt offers several networking commands that help analyze and configure network settings:
-
netstat
: Displays active network connections and listening ports.netstat -a
-
net use
: Connects or disconnects a computer from a shared resource, like a network drive.net use Z: \ServerShare
-
nslookup
: Queries the DNS to resolve a domain name or IP address.nslookup google.com
Environment Variables
Environment variables are dynamic values that can affect the processes and behaviors of the system. They can be viewed or modified in the Command Prompt using the following commands:
-
set
: Displays all environment variables for the current session.set
-
set VAR_NAME=value
: Sets a new variable namedVAR_NAME
with the specified value.set PATH=C:Tools;%PATH%
Batch Files and Scripting
Batch files are a powerful feature of the Windows Command Line, allowing users to automate tasks through scripting. A batch file typically has a .bat
or .cmd
extension and contains a series of commands that the command interpreter executes in sequence.
An example script to back up a directory might look like this:
@echo off
set source=C:ImportantFiles
set destination=D:Backup
xcopy %source% stination% /s /i /y
echo Backup complete!
pause
Running Commands as Administrator
Some commands require elevated privileges to execute. To run Command Prompt as an administrator:
- Search for «cmd» in the Start menu.
- Right-click on «Command Prompt» and select «Run as administrator.»
This is particularly necessary for commands like chkdsk
, diskpart
, and netsh
.
Common Error Messages
Understanding common error messages can help troubleshoot problems encountered in the Command Prompt:
- «Access Denied»: Indicates that you do not have the necessary permissions to execute a command.
- «File Not Found»: The specified file or directory does not exist.
- «Invalid Switch»: An incorrect command option was provided. Use the
/help
flag for correct usage.
Customizing Command Prompt
Users can customize the appearance and behavior of the Command Prompt to enhance their productivity:
-
Changing the Color Scheme: By right-clicking the title bar and selecting «Properties,» you can adjust colors, fonts, and window size.
-
Creating Aliases: You can create simple commands or aliases in a batch file. For example, adding
alias ll=dir
allows you to usell
instead of typingdir
.
Advanced Command-Line Utilities
Windows includes several advanced command-line utilities that can be accessed via the Command Prompt:
-
PowerShell: A more powerful and versatile scripting environment that allows for complex task automation and system management.
-
Windows Subsystem for Linux (WSL): Enables running a Linux distribution alongside Windows, providing access to Linux command-line tools.
Conclusion
The Windows Command Line remains a vital tool for numerous users and professionals across various domains, from system administration to software development. While the interface may seem intimidating to those unfamiliar with it, the commands and utilities available through CMD can enhance productivity, facilitate automation, and provide powerful system management capabilities. This reference guide aims to serve as a foundational resource for users looking to deepen their understanding of the Windows Command Line and harness its full potential.
With the knowledge presented here, users can confidently navigate the command line, perform essential tasks efficiently, and explore the advanced functionalities that the Windows operating system has to offer. Whether you’re troubleshooting network connectivity, managing files, or automating repetitive tasks, mastering the Windows Command Line is a valuable skill that can serve you well in your computing journey.