Download Windows Command Line Cheat Sheet PDF (2024)

Windows is the world’smost commonly used operating system, providingseveral features and applications to ease your work. One important yet sometimes overlooked built-in feature is the command prompt. With it, you can manage your entire system from a single interface with the help of commands.

Windows cmd commands are abundant, allowing you to perform various useful tasks without navigating through the system. But it’s tricky to remember every single one. That’s why we curated a Windows command line cheat sheet with Windows terminal commands – to help experienced and beginnerprogrammersmake the best use of Windows commands.

You can keep this Windows command prompt cheat sheet handy and refer to it when you want to perform any task.

Let’s get started with the list of commands.

Scroll through this cheat sheet to see Windows command line commands by category.

Net user allows you to add, remove, and alter the user accounts via command prompt. You can simply execute the command on various systems, such as Windows, including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server Operating Systems, and some older versions of Windows.

The Windows system organizes every file and folder. Windows also allows you to perform tasks on your files and directories, such as copying, creating, removing, etc. This section lists some commands that will help you to perform directory tasks.

Below are some more commands that will let you move through the directories and perform actions.

Command

Description

CHKDISK

syntax- chkdsk [volume:] [/F] [/V] [/R] [/X] [/I] [/C] [/L:size] [/perf] [/scan] [/spotfix]

CHKDISK getsdetails of a specified disk and repairs or recovers data on the drive if required.

volume: This is the drive letter of the partition for which you want to check for errors.

/F Fixes any errors found on the disk

/V Displays the full path and name of every file on the disk. If used on an NTFS volume, it will show any cleanup messages

/R Locates bad sectors and recover any readable information from them. This option implies /F when /scan is not specified

/X Implies /F and will force a dismount of the volume if necessary

/I Performs a less vigorous chkdsk command and instructs the command to run faster by skipping over certain regular checks

/C Same as /I but skips over cycles within the folder structure to reduce the amount of time that the chkdsk command runs

/L:size Changes the size (in KB) of the log file. The default log file size for chkdsk is 65536 KB.

/perf Runs faster by using more system resources. It must be used with /scan

/scan Runs an online scan on an NTFS volume without repairing it. Here, "online" means that the volume does not need to be dismounted, but can instead remain online/active.

/spotfix Dismounts the volume only briefly to fix issues sent to the log file.

.

CHKNTFS

syntax- chkntfs <volume> [...]

chkntfs [/d]

chkntfs [/t[:<time>]]

chkntfs [/x <volume> [...]]

chkntfs [/c <volume> [...]]

CHKNTFSdisplays and alters automatic disk checking when the computer is started

<volume> [...] Specifies one or more volumes to check when the computer starts. Valid volumes include drive letters, mount points, or volume names.

/d Restores all chkntfs default settings, except the countdown time for automatic file checking. By default, all volumes are checked when the computer is started, and chkdsk runs on those that are dirty.

/t [:<time>] Changes the Autochk.exe initiation countdown time to the amount of time specified in seconds. Without the time parameter, /t will show the current countdown time.

/x <volume> [...] Specifies one or more volumes that you want to exclude from checking when the computer is started, even if the volume is marked as requiring chkdsk

/c <volume> [...] Sets the schedules one or more volumes to be checked when the computer is started, and runs chkdsk on those that are dirty

COMPACT

syntax- compact [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [/EXE[:algorithm]] [/CompactOs[:option] [/windir:dir]] [filename [...]]

COMPACTdisplaysand alters the compression of files or directories on NTFS partitions.

/c Compresses the specified directory or file

/u Uncompresses the specified directory or file

/s[:<dir>] Performs the chosen operation on files in the specified directory and all subdirectories. By default, the current directory is used as the <dir> value.

/a Shows the hidden or system files. By default, these files aren't included.

/i Continues the specified operation and ignores all errors. By default, this command stops when an error is encountered.

/f Forces the compression or decompression of the specified directory or file. It will skip the already-compressed files. The /f parameter is used in the case of a file that was partly compressed when the operation was interrupted by a system crash.

/q Reports only the most essential information

/EXE Uses the compression optimized for executable files that are read frequently, but not modified. Supported algorithms are:

  • XPRESS4K (fastest and default value)
  • XPRESS8K
  • XPRESS16K
  • LZX (most compact)

/CompactOs Sets or queries the system's compression state. It supports the following options.

  • queryqueries the system's Compact state
  • alwayscompresses all the operating system binaries and sets the system state to Compact, which remains unless administrator changes it
  • neverUncompressed all the operating system binaries and sets the system state to non-Compact, which remains unless the administrator changes it
  • <filename> Mentions a pattern, file, or directory. You can use multiple file names, and the * and ? wildcard characters.

CONVERT

syntax- convert basic

convert dynamic

convert gpt

convert mbr

These commands will let you convert a disk from one disk type to another.

convert basic command Converts an empty dynamic disk into a basic disk

convert dynamic command Converts a basic disk into a dynamic disk

convert gpt command Converts an empty basic disk having master boot record partition style into a basic disk with the GUID partition table (GPT) partition style

convert mbr command Converts an empty basic disk with the GUID Partition Table (GPT) partition style into a basic disk with the master boot record (MBR) partition style

DISKPART

syntax- diskpart <parameter>

The DISKPART command help you manage your computer's drives. It comes with the following parameters:

active Marks the disk's partition with focus, as active

add Lets you mirror the simple volume with focus to the specified disk.

assign Lets you assign a drive letter or mount point to the volume with focus

attach vdisk Lets you attach a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive

attributes Lets you display, set, or clear the attributes of a disk or volume

automount Allows you to enable or disable the automount feature

break Breaks the mirrored volume with focus into two simple volumes.

clean Removes any and all partition or volume formatting from the disk with focus

compact vdisk Compacts the physical size of a dynamically expanding virtual hard disk (VHD) file

convert Converts the file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and directories intact

create you can create a partition on a disk, a volume on one or more disks, or a virtual hard disk (VHD)

DeleteLetsyou delete a partition or a volume

detach vdisk Lets youstop the selected virtual hard disk (VHD) from appearing as a local hard disk drive on the host computer

detail Shows you the information about the selected disk, partition, volume, or virtual hard disk (VHD)

exit Exits the diskpart command interpreter

expand vdisk Lets you expand a virtual hard disk (VHD) to the size that you specify

extend- Lets you expand the volume or partition with focus, along with its file system, into free (unallocated) space on a disk

filesystems Shows the information about the current file system of the volume with focus and lists the file systems that are supported for formatting the volume

Format Lets youformat a disk to accept Windows files

gpt Lets you assign the gpt attribute(s) to the partition with focus on basic GUID partition table (gpt) disks

help Shows a list of the available commands or detailed help information on a specified command

import Importsa foreign disk group into the disk group of the local computer

inactive Lets you mark the system partition or boot partition with focus as inactive on basic master boot record (MBR) disks

list Shows a list of disks, of partitions in a disk, of volumes in a disk, or of virtual hard disks (VHDs)

merge vdisk Merges a differencing virtual hard disk (VHD) with its corresponding parent VHD

offline Takes an online disk or volume to the offline state

online Takes an offline disk or volume to the online state

recover Lets you refresh the state of all disks in a disk group, attempt to recover disks in an invalid disk group, and resynchronize mirrored volumes and RAID-5 volumes that have stale data

Rem Addscomments to a script

Remove- Lets you remove a drive letter or mount point from a volume

Repair- Lets you repair the RAID-5 volume with focus by replacing the failed disk region with the specified dynamic disk

rescan- Lets you scan the new disks that may have been added to the computer

retain Prepares an existing dynamic simple volume to be used as a boot or system volume

san Shows or sets the storage area network (san) policy for the operating system

select Lets you shift the focus to a disk, partition, volume, or virtual hard disk (VHD)

set id Lets you change the partition type field for the partition with focus

shrink Lets you reduce the size of the selected volume by the amount you specify

uniqueid Shows or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature for the disk with focus

FORMAT

syntax- format volume [/FS:file-system] [/V:label] [/Q] [/L[:state]] [/A:size] [/C] [/I:state] [/X] [/P:passes] [/S:state]

format volume [/V:label] [/Q] [/F:size] [/P:passes]

format volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]

format volume [/V:label] [/Q] [/P:passes]

format volume [/Q]

FORMATLets you format a disk to accept Windows files. You must be in the Administrators group to format a hard drive.

<volume> Mentions the mount point, volume name, or drive letter (followed by a colon) of the drive that you want to format

/FS:filesystem Mentions the type of file system (FAT, FAT32, NTFS, exFAT, ReFS, or UDF)

/V:<label> Mentions the volume label. Without /V command-line option, format prompts you for the volume label after the formatting is complete.

/A:<size> Specifies the allocation unit size to use on FAT, FAT32, NTFS, exFAT, or ReFS volumes

/Q Performs a quick format. Deletes the file table and the root directory of a previously formatted volume.

/F:<size> Mentions the size of the floppy disk to format. When possible, use this command-line option instead of the /T and /T command-line options.

/T:<tracks> Mentions the number of tracks on the disk. When possible, use the /F command-line option instead.

/N:<sectors> Specifies the number of sectors per track. When possible, use the /F command-line option instead of /N. If you use /N, you must also use /T.

/P:<count> Zero every sector on the volume

/C NTFS only.

/X Forces the volume to dismount, if necessary, before it's formatted

/R NTFS only. Files will be compressed by default

/D UDF 2.50 only. Metadata will be duplicated.

/L:<state> NTFS only. Overrides the default size of file record./S:<state> Mentions the support for short filenames. State is either enable or disable. Short names are disabled by default.

/TXF:<state> Mentions the TxF is enabled/disabled. TxF is enabled by default

/I:<state> ReFS only. Specifies whether integrity should be enabled on the new volume. State is either enable or disable.

/DAX:<state> NTFS only. Enables the direct access storage (DAX) mode for this volume. In DAX mode, the volume is accessed via the memory bus, boosting IO performance.

/LogSize::<size> NTFS only. Specifies the size for NTFS log file in kilobytes. The minimum supported size is 2MB, so specifying a size smaller than 2MB will result in a 2MB log file. Zero indicates the default value, which generally depends on the volume size.

/NoRepairLogs NTFS only. Disables the NTFS repair logs. If the spotfix flag for chkdsk is specified (i.e. chkdsk /spotfix), this will not work.

FSUTIL

Lets you perform tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume.

LABEL

syntax- label [/mp] [<volume>] [<label>]

You can create, change, or delete the volume label (that is, the name) of a disk. Without parameters, the label command changes the current volume label or deletes the existing label.

/mp Mentions that the volume should be treated as a mount point or volume name.

<volume> Specifies a drive letter, mount point, or volume name. If a volume name is specified, the /mp parameter is unnecessary

<label> Specifies the label for the volume

RECOVER

syntax- recover [<drive>:][<path>]<filename>

RECOVER will let you recover the readable information from a bad or defective disk.

[<drive>:][<path>]<filename> Specifies the file name (and the location of the file if it is not in the current directory) you want to recover. Filename is required and wildcards aren't supported.

VOL

syntax- vol [<drive>:]

VOLShows the disk volume label and serial number

<drive>: Specifies the drive with the disk for which you want to display the volume label and serial number.

As one of the most versatile operating systems,Windows allows you to execute as many tasks as you want with different commands.

This Windows command line cheat sheet gives you a detailed run-through of every possible command, helping you understand each one’s performance. To run them, all you need is a basic knowledge of Command Line and administrator access.

Interested in finding more cheat sheets to help you with work or school? Check out ourJava Cheat Sheet!

You can use online or offline resources and explore different tasks you’d like to perform. Each task will have a corresponding command line.

Our Windows command prompt cheat sheet lists plenty of commands, but we’ll list a few more below for your reference:

Right-click on the title bar -> Properties -> click on “Colors” -> choose the colors -> Click OK.

Type “help” and hit enter to get a list of all available commands in command prompt.

Download Windows Command Line Cheat Sheet PDF (2024)
Top Articles
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 6398

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.