Windows Command Lines
Windows Command Lines
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
GRAB DISCOUNTS
Introduction
The Windows operating system features over 280 commands for CMD (Command Prompt). Some commands are specific
to Windows servers, while others are available for desktop versions. In both cases, CMD commands communicate directly
with the OS and allow to perform various IT automation tasks.
This guide showcases important Windows CMD commands and provides hands-on examples.
https://phoenixnap.com/kb/cmd-commands 1/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
Prerequisites
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
Below is an overview of some common Windows CMD (Command Prompt) commands. Every command has a brief
explanation and an example use case.
1. arp Command
The arp (address resolution protocol) command shows and modifies entries in the ARP cache. The cache contains one or
multiple tables that map IP addresses to resolved physical addresses.
Without any parameters, the arp command shows the help window.
arp -a
https://phoenixnap.com/kb/cmd-commands 2/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The output lists all the current ARP entries grouped by the interface.
2. assoc Command
The assoc (association) command lists and modifies file extension associations on the system. The syntax for the
command is:
assoc .<extension>=<filetype>
Without any parameters, the command prints the current file extension associations.
Use the assoc command to view, change, or remove file associations. For example, to view the .log file associations, run:
assoc .log
https://phoenixnap.com/kb/cmd-commands 3/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
assoc .log=txtfile
Alternatively, remove all file associations for files with the .log extension by running:
assoc .log=
The command requires adding a space after the equals sign to remove the association.
3. attrib Command
The attrib (attribute) command shows or changes file attributes. The possible attributes are:
R - Read-only.
H - Hidden.
S - System file.
The plus sign (+) sets an attribute, while the minus sign (-) removes an attribute from a file. Without any options, the
command shows the file attributes in the current directory.
To set a file to have the read-only (R) and hidden (H) attributes, use the following command:
attrib +R +H sample_file.txt
attrib -H sample_file.txt
https://phoenixnap.com/kb/cmd-commands 4/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
minus removes the attribute
OFFER: Get from
up tothe
30%fileOFF
andSelected
returns the file Metal
Bare to the Cloud
defaultInstances!
visible state.
4. bcdboot Command
The bcdboot (boot configuration data boot) command sets up a system partition by copying BCD files into an empty
partition.
bcdboot <path>
bcdboot C:\Windows
5. cd Command
The cd (change directory) command shows or changes the current location. The syntax for the command is:
cd <directory>
The directory parameter is optional, and without it, the command prints the current working directory.
For example, to change the location to a directory named Public, add the directory name after the command:
cd Public
The prompt reflects the change and shows the new location.
To change the location to a different disk, add the /d option before the path. For example, to change to disk S:\ use:
cd /d S:
https://phoenixnap.com/kb/cmd-commands 5/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
cd ..
The current directory changes to one directory above the current location.
6. chkdsk Command
The chkdsk command scans the local file system and metadata for errors. The syntax for checking a disk is:
Without additional parameters, the chkdsk command shows the current disk state without fixing any errors.
chkdsk <volume> /f
The command attempts to fix errors on the disk. If the disk is in use, run the check on the next system restart. Stopping
the command does not affect the system, but ensure to run the scan later to fix any potential data corruption.
7. choice Command
The choice command prompts a user to choose an answer from a list of options. Without any parameters, the command
prompts the user to choose between Y and N options.
https://phoenixnap.com/kb/cmd-commands 6/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
choice /c ync
Insert additional text to explain the available options with the /m parameter. For example:
In all cases, the command returns the choice index and exits.
8. cipher Command
The cipher command shows and modifies the encryption for files or directories. The command syntax is:
Without any options, the cipher command shows the encryption state for all files and directories in the current location.
The U represents "unencrypted," whereas E is "encrypted."
The file's indicator changes from U to E, which marks the file as encrypted.
Note: The encrypting and unencrypting files and directories feature is available for Windows 10 Pro,
Enterprise, and Education editions.
https://phoenixnap.com/kb/cmd-commands 7/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
9. clip Command
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The clip command copies a command output or file contents to the clipboard. The syntax for copying a command's
output in CMD is:
<command> | clip
For example, to copy the current directory path, pipe the cd command to clip:
cd | clip
Paste the contents anywhere in the window using CTRL+V (or right-click in CMD).
For example, to copy the contents of a sample.txt file to the clipboard, run:
The file's contents are saved to the clipboard and can you can paste them anywhere.
Note that the previous contents and output do not return to the screen.
Without additional parameters, the cmd command shows the current cmd.exe program version.
Use cmd to run commands without affecting the current session. For example, to test a command and return to the current
command interpreter session, use the /c parameter:
cmd /c cd ..
https://phoenixnap.com/kb/cmd-commands 8/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
new interpreter changes the directory.
OFFER: Get up to 30%However, the /c Bare
OFF Selected tag ensures the interpreter
Metal Cloud returns to the original session, and
Instances!
the directory stays unchanged.
To run a command and stay in the new session, use the /k parameter:
cmd /k cd ..
The /k parameter switches to the new session and runs the cd command to switch to the parent directory.
color <background><font>
The color attributes are hexadecimal numbers from 0 to f. The help window displays all the possible color options:
help color
For example, to change the background to blue (1) and the font to light aqua (b), run:
color 1b
To return to the default console colors, run the color command without options.
https://phoenixnap.com/kb/cmd-commands 9/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
syntax for the command is: up to 30% OFF Selected Bare Metal Cloud Instances!
OFFER: Get
Without any options, the comp command starts an interactive prompt to enter file names and additional options.
To demonstrate how the command works, compare two text files with the following contents:
Run the comp command and provide the two file names:
The output prints the comparison error as characters in hexadecimal format and asks to compare more files (enter N to
exit).
The comparison fails at character "s" in the first file and character "x" in the second file.
Without any options or parameters, the compact command prints the compression state in the current directory.
https://phoenixnap.com/kb/cmd-commands 10/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
For example, to compress a file, use the /c parameter and provide the file name:
compact /c sample_file.txt
compact /u sample_file_1.txt
Use the compact command to save disk space and compress large files and directories.
For example, to copy a file's contents into a new file in the same location, use:
https://phoenixnap.com/kb/cmd-commands 11/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
command creates the new
OFFER: Getfile
upand copies
to 30% all Selected
OFF the contents
Barefrom theCloud
Metal sourceInstances!
file.
date
Enter the date as mm-dd-yyyy to change the current date on the system or exit with CTRL+C.
Use the /t parameter to avoid modifying the system state and only print the current date:
date /t
The command shows the day of the week and the current date.
defrag C:\ /u /v
https://phoenixnap.com/kb/cmd-commands 12/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The /u parameter prints the progress, while /v shows a verbose output. These parameters are optional.
Both commands permanently delete the specified file or files from a disk and are irretrievable.
del sample.txt
Or alternatively:
erase sample.txt
del /p sample.txt
The output shows a prompt with the file name and requires confirmation before deleting the file.
The LIMITED-TIME
dir (directory) command lists
OFFER: Get updirectory contents,
to 30% OFF including
Selected Barefiles
Metaland subdirectories.
Cloud Instances!The syntax for the command is:
The dir command without options shows information for the current directory.
dir C:\
Volume drive.
Volume serial number.
Directory contents with modification time.
File and directory count.
For example, to see the command history from the current command prompt session, run:
doskey /history
https://phoenixnap.com/kb/cmd-commands 14/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
output shows allOFFER:
the commands from
Get up to the
30% CMD
OFF sessionBare
Selected fromMetal
oldestCloud
to newest.
Instances!
driverquery <options>
Without any options, the driverquery command shows device drivers on the local machine. Additional options control
the output format or allow querying remote machine drivers.
echo <message>
To use the command and show a "Hello, world!" message to the screen, run:
The echo command often appears in scripts to print useful information while the script runs.
https://phoenixnap.com/kb/cmd-commands 15/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
exit /b
Without the /b option, the exit command closes the command interpreter.
24. fc Command
The fc (file compare) command compares two or more files. The output prints the contents to the console if there is a
difference between the files.
For example, to compare two sample files, sample_file_1.txt and sample_file_2.txt, run:
fc sample_file_1.txt sample_file_2.txt
The command prints the file contents, indicating there is a difference between the two files.
https://phoenixnap.com/kb/cmd-commands 16/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
find "text" <file>
The command looks for an exact match and returns the file name along with the line of text that contains the string. If a
file does not contain the text, the command returns the file name without the text.
If the command does not return a result, the string is not in the file.
The file type parameter is the file to show or modify (such as txtfile), while the open command option is a string that
calls a program to read the file type. The open command string substitutes the file name into the open command to run a
file in the provided program.
Without any options, ftype prints all file types and extension associations.
https://phoenixnap.com/kb/cmd-commands 17/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
To show the current file type and extension association for text files, enter:
ftype txtfile
ftype txtfile=
The command omits the program for opening files and removes the program association.
getmac <options>
Additional options provide detailed information about a remote computer or control the output display. For example, to
show the MAC addresses in the CSV format, use:
https://phoenixnap.com/kb/cmd-commands 18/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
Use LIMITED-TIME
the command toOFFER:
parse the MAC
Get address
up to to aSelected
30% OFF network monitoring
Bare Metaltool or toInstances!
Cloud check the protocols on network adapters.
help <command>
For example, to view the help menu for the cd command, run:
help cd
Use any key to go through the pages if the help page is larger than the command line. Alternatively, press CTRL+C to exit.
Note: For non-system commands, use the following format to see the help window:
<command> /?
hostname
The command does not have options, and providing any additional parameters throws an error. The hostname command
is available for systems with TCP/IP installed on a network adapter.
https://phoenixnap.com/kb/cmd-commands 19/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
31.LIMITED-TIME
ipconfig Command
OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The ipconfig (IP configuration) command is a networking CMD tool that shows all current TCP/IP network configuration
information. The command also refreshes DHCP and DNS settings.
ipconfig <options>
Omitting options shows the basic TCP/IP configuration for all adapters:
ipconfig
ipconfig /all
Renew the DHCP IP address for the local area connection with:
ipconfig /flushdns
https://phoenixnap.com/kb/cmd-commands 20/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
32.LIMITED-TIME
label Command
OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The label command shows, changes, or removes the volume label (name) of a disk. The command requires
administrator privileges to perform any changes.
Without any options, the label command shows the label for the C:\ drive and starts a prompt to change the name:
label
Press Enter to remove the label, or enter a new name to change the current label name. Confirm the change with Y or
press N to keep the existing name.
Use the following syntax to create .cab files with the makecab command:
For example, to create a sample_cab.cab file in the current directory and add a sample_file.txt file to the archive, use:
The output prints the compression progress and exits when done.
md <path>
mkdir <path>
For example, to make a new subdirectory called Subdir in the current location, run:
https://phoenixnap.com/kb/cmd-commands 21/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
mkdir Subdir
md Subdir\Subsubdir
Without any additional options, the mlink command creates a symbolic link to a file. For example:
https://phoenixnap.com/kb/cmd-commands 22/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
mklink /h my_link sample_file.txt
The dir command shows the links in the directory listing. To enter the directory, use the cd command and treat the link as
a regular directory (cd Docs).
more <path>
For example, run the help cd command and pipe the more command to truncate the output:
help cd | more
Press Enter to go to the following line and Space to go to the next page. To exit, press q.
https://phoenixnap.com/kb/cmd-commands 23/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
command syntaxOFFER:
is: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The command does not require a drive letter to link a volume. Without any parameters, the mountvol command shows the
help menu, mount points, and possible volume names.
For example, to list the volume name and current mount point for the C:\ drive, run:
mountvol C:\ /l
The output shows the GUID for the volume, which is a unique unchanging identifier.
The source and destination are either a folder or a file. The move command renames a file if the source and destination
locations are the same but have different file names.
For example, the following command renames a file named sample_file.txt to file.txt:
https://phoenixnap.com/kb/cmd-commands 24/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
move C:\Users\Public\Downloads\my_file.txt C:\Users\Public\Desktop\my_file.txt
If overwriting an existing file, the command prompts to confirm, unless the command runs as part of a batch script.
Note: Learn more about working with bash scripts by referring to our articles How to Write a Bash
Script and How To Run A Bash Script.
The program features various install, display, update, and repair options. Without any options, the msiexec command
opens a window to show the command information.
msiexec /i "C:\example.msi"
The /i option indicates a normal installation of the .msi package located at the provided path.
https://phoenixnap.com/kb/cmd-commands 25/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
msinfo32 <options>
Additional options filter the information or export the data into specific file formats. For example, to export all system
information into an.nfo file, use:
For example, to start an RDC session in full-screen mode, use this command:
mstsc /f
https://phoenixnap.com/kb/cmd-commands 26/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
Without additional parameters, the net command shows all available subcommands with a short description.
Use the net start command to list all running Windows services:
net start
View the login and password requirements for a user with the following:
net accounts
https://phoenixnap.com/kb/cmd-commands 27/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The output shows a detailed help window for any provided command.
netstat <options>
The command displays active TCP connections when used without options. The output shows the protocol, local and
foreign addresses, and the TCP connection state.
Add the -a option to display all active TCP connections and listening TCP and UDP ports:
netstat -a
Use the command to scan for open ports or to check the port protocol type.
https://phoenixnap.com/kb/cmd-commands 28/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
44.LIMITED-TIME
nslookupOFFER:
Command
Get up to 30% OFF Selected Bare Metal Cloud Instances!
The nslookup command is a DNS infrastructure diagnostics tool for web servers. The command features a non-
interactive mode for looking up a single piece of information and an interactive mode for looking up additional data.
Without any options, nslookup enters interactive mode. To find DNS records for a specific domain name, use:
nslookup <domain>
path <location>
Without any parameters, path shows the current state of the PATH variable.
To add multiple locations to PATH, separate each location with a semicolon (;) as in the following example:
https://phoenixnap.com/kb/cmd-commands 29/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
46.LIMITED-TIME
ping Command
OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The ping command is another essential network troubleshooting tool. The command checks the connectivity with
another machine by sending ICMP request messages.
ping phoenixnap.com
The output prints corresponding reply messages and round-trip times. Use the command to check for connectivity and
name resolution issues.
powercfg /list
https://phoenixnap.com/kb/cmd-commands 30/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The output lists all power schemes on the system. The active power scheme has an asterisk (*).
The prompt command offers various variables to add special characters or additional features to the prompt. For
example, to change the prompt to an arrow, use:
prompt --$g
The $g variable represents the greater-than sign (>) and the prompt stays during the command-line session.
rd <path>
rmdir <path>
Attempting to delete a directory with files results in an error message. Add the /s parameter to delete a directory with
subdirectories and files to avoid the error message:
rd /s <path>
The command deletes the complete subdirectory tree and all files.
https://phoenixnap.com/kb/cmd-commands 31/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
50.LIMITED-TIME
ren and rename Commands
OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The ren and rename commands rename files or directories. The syntax for the two commands is:
The commands do not allow moving the files to a different location. Wildcard characters work for multiple files. For
example, to change all .txt files to .c files, use:
The asterisk (*) character helps discover all file names in the current directory with the .txt extension and renames the
files to have the .c extension.
The main benefit when using robocopy is the /mt parameter for higher-performance multithreading. Additionally, the /z
parameter lets you restart a transfer in case of interruptions.
https://phoenixnap.com/kb/cmd-commands 32/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
Use the command for large file transfers that are sensitive to interruptions.
route print
https://phoenixnap.com/kb/cmd-commands 33/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The LIMITED-TIME
output prints theOFFER:
interface list,upand
Get to IPv4
30% and
OFFIPv6 routing
Selected tables.
Bare Metal Cloud Instances!
schtasks /<subcommand>
schtasks /query
The output displays task names, next run times, and task statuses.
set <variable>=<value>
Without additional parameters, the set command shows all environment variables.
https://phoenixnap.com/kb/cmd-commands 34/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The variables are available to use with any command. For example, to create a new CMD variable called message, use:
echo %message%
Encasing the variable in the percent signs (%) reads the value and outputs it to the screen.
Note: The variables do not persist and are only valid for the current command-prompt session.
For example, to scan the system and repair all files, use the following command:
sfc /scannow
https://phoenixnap.com/kb/cmd-commands 35/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The command scans all protected system files and repairs problematic files when possible.
shutdown <options>
Without any arguments, the shutdown command opens the help menu.
For example, to shut down and restart the computer, use the /r option:
shutdown /r
shutdown /s
In both cases, the shutdown is not immediate. To cancel the action, use the /a option:
shutdown /a
https://phoenixnap.com/kb/cmd-commands 36/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
sort sample_file.txt
The command sorts the file contents and prints the result to the console.
For example, to load start a new command-prompt session with the title "Hello, world!" and set the path to C:\. enter the
following command:
A new CMD window opens with the starting path on the C:\ drive and a custom title.
Use the command without options to show the local system information:
https://phoenixnap.com/kb/cmd-commands 37/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
systeminfo
Additional options allow checking system information for remote computers or controlling the output format. For
example, show the output in CSV format with:
takeown /f <file>
A common way to end a task is to find the process ID (PID) with the tasklist command and end the process with:
https://phoenixnap.com/kb/cmd-commands 38/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
tasklist <options>
Without additional options, the command shows all currently running processes.
The image name and PID are unique identifiers for a process. The final column shows the memory usage for a process.
This is a good indicator for identifying processes that slow down the system.
https://phoenixnap.com/kb/cmd-commands 39/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
Note: You can use the telnet command to ping a specific port on Windows.
time
Enter a new time to change the system time or exit the prompt using CTRL+C. Use the /t option to avoid making
modifications:
time /t
The command prints the current time and returns to the command line.
timeout /t <seconds>
timeout /t 10
The output counts down and returns to the command line. Press any key to interrupt the timeout earlier. Use the
command in scripts to wait for execution between two commands.
https://phoenixnap.com/kb/cmd-commands 40/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
title <string>
The CMD window title changes to the provided string. Use the command when running multiple batch scripts to
differentiate between different command prompts.
tracert phoenixnap.com
The output shows the hops between the source and destination, providing an IP address and name resolution where
applicable. Use the command to discover connectivity issues to a host.
https://phoenixnap.com/kb/cmd-commands 41/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
68.LIMITED-TIME
tree Command
OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The tree command displays the contents inside a drive or directory in a tree-like structure. The syntax is:
Without any options, the tree command displays the directory structure of the C:\ drive.
For example, to show the contents of the file called sample_file.txt, run:
type sample_file.txt
The output prints the file's contents to the command line. Use this command to preview files directly in the command
prompt.
tzutil /g
https://phoenixnap.com/kb/cmd-commands 42/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The output shows the time zone ID. List all available time zone IDs with:
tzutil /l | more
The more command helps truncate long outputs. Use the /s parameter and provide the time zone ID to change the system
time zone.
ver
The version prints to the output and returns to the command line.
vol <drive>:
Without a specified drive, the vol command shows information for the currently selected drive.
Omitting the location searches for the file in the current directory without going through subdirectories. To perform a
recursive search, add the /r parameter. For example:
https://phoenixnap.com/kb/cmd-commands 43/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
The command searches the C:\ drive and all subdirectories. If the file is found, the command returns the location path.
whoami <options>
Without options, the command shows the domain and user name.
Add the /all parameter to show detailed information for the current user:
whoami /all
The user's name, security ID, groups, and privileges print to the console.
For example, use the following command to copy contents from one location to another, including subdirectories (even if
empty):
https://phoenixnap.com/kb/cmd-commands 44/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
xcopy <source> <destination> /s /e
The /s parameter enables subdirectory copy, while /e includes empty directories. If any files with the same name exist in
the destination, the command prompts before overwriting.
Conclusion
After reading and trying out the commands from this guide, you've familiarized yourself with the Windows Command
Prompt (CMD) tool. Windows allows performing a variety of tasks through the command prompt using just commands.
Continue practicing and researching commands further to master the Command Prompt in Windows.
https://phoenixnap.com/kb/cmd-commands 45/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
LIMITED-TIME OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
Milica Dancuk
Milica Dancuk is a technical writer at phoenixNAP who is passionate about programming. Her background in Electrical
Engineering and Computing combined with her teaching experience give her the ability to easily explain complex technical
concepts through her content.
Security, SysAdmin
How to Change or
Reset
Administrator
Password on
Windows Server
July 7, 2019
MySQL, SysAdmin
How to Connect to
MySQL from
Windows
Command Line
May 3, 2019
MySQL is a popular
and open-source
relational database
application. Many
servers make use...
READ MORE
Networking, SysAdmin
How to Edit Hosts
File in Linux,
Windows, or Mac
October 22, 2018
https://phoenixnap.com/kb/cmd-commands 46/47
10/13/23, 5:22 PM Windows CMD Commands: Mastering the Command Prompt
The hosts file in OFFER: Get up to 30% OFF Selected Bare Metal Cloud Instances!
LIMITED-TIME
Windows, Mac, or
Linux maps hostnames
to IP...
READ MORE
SysAdmin
How to Install
winget (Windows
Package
Manager)
April 21, 2022
winget is Microsoft's
package manager for
Windows 10 and 11.
This tutorial shows
how to install and
use...
READ MORE
https://phoenixnap.com/kb/cmd-commands 47/47