20 Command Prompt Commands for Sys Admins

command prompt commands
Spread the love

Here is my ultimate list of command prompt commands for very serious Windows Systems Administrators. For each command, I explain the syntax, and parameters. Then I give examples.

The commands are grouped into 5 – General Command Prompt Commands, Commands to Manage Disks & Partitions, Commands to Copy Files and Folders, System Admin and Reporting commands and Commands for Managing Files and Folders.

If you need to read about a particular command prompt command, expand the Table of Contents below, then click the command you require.

General Command Prompt Commands


The HELP command provides help information for Windows commands. When you type HELP in cmd without any parameters, it lists and briefly describes every system command.

Sponsored Content

This is very useful if you are trying to find a particular command but can’t remember it.

HELP Syntax

HELP [<command>]


[<command>] /?

<command> is the Windows command you want to get information about.

HELP Parameters

<command>Specifies the name of the command prompt command you want information about

HELP Examples

As an example, to get information about the DIR command, type the following command and press enter.

Command Prompt Commands

The command below will achieve the same result as HELP DIR:

DIR /?


The DIR command displays a list of files and sub-directories in a directory. If you use DIR without any parameter, it displays volume label, Volume Serial Number and a list of folders in the path.

DIR Syntax

The full syntax of the DIR command is

DIR [drive:] [path] [filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]    [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

For the purpose of this guide, I will limit the syntax to include parameters that you need to use regularly. Below is the modified syntax for DIR command.

DIR [drive:] [path] [filename] [/A[[:]attributes]] [/P] [/Q] [/W] [/D] [/L]  /O[[:]<SortOrder>]  [/S]

DIR Parameters

[drive:][path][filename]Specifies drive, directory, and/or files to list.
[/A[[:]Attributes]]Displays files with specified attributes. Click Attributes for more information
/PPauses after each screenful of information. To see the next screen, press any key.
/QDisplay file ownership information.
/WDisplays the results in wide list format.
/DSame as /W but files are sorted by column.
/LDisplays directory and file names in lowercase (lists are not sorted).
/O[[:]<SortOrder>]Files are listed as defined by <SortOrder>
/SDisplays all files in the specified directory and all sub-directories.


If /A is used without specifying Attributes, DIR displays the names of all files, including hidden and system files. This is very useful if you wish to see hidden files in a directory.

DIR Examples

To display all top directories in drive C in wide list, use this command below:


To display owners of the files, use the one below:


Here are the results:


CD is the short version of CHDIR. CHDIR displays the name of or changes the current directory to another directory.

CHDIR Syntax

CHDIR [/D] [drive:] [path]


CHDIR [..]

“..” changes to the parent directory.

CD Parameters

/DChanges the current drive as well as the current directory for a drive.
[drive:]Specifies the drive to display or change to. (if different from the current drive).
[path]Specifies the path to the directory that you want to display or change to.
[..]Tells command prompt to change to the parent folder of the current directory.

CD Examples

In the example below, I want to change from my current directory (\Victor) to the parent directory C:\

CD ..

To change to the directory, C:\G-Drive\flatsome, enter the command:

CD C:\G-Drive\flatsome


Command Prompt Commands to Manage Disks & Partitions

The next set of command prompt commands are used to check your disk for errors, fix problems with your disk or format disks.


Checks the file system and file system metadata of a disk volume for logical and/or physical errors. It then displays a status report.


The full syntax is:

CHKDSK [<volume>[[<path>]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix]

I will only discuss parameters that you will require to use often. Below is the modified syntax I will discuss in this guide:

CHKDSK [volume[[path]filename]]] [/F] [/R] [/X] [/B] [/SCAN]

Sponsored Content


If you use CHKDSK without specifying any parameters, it displays just the status of the volume without fixing any errors. Running CHKDSK requires admin permission.

CHKDSK Parameters

<volume>Specifies the drive letter (followed by a colon), mount point, or volume name.
[<Path>] <filename>Specifies the location and name of a file or set of files that you want CHKDSK to check for fragmentation.
/FFixes errors on the disk. The disk cannot be used by another process. If the disk is in use by another process, you will be prompted to fix errors at next reboot.
/RLocates bad sectors and recovers readable information. If the /scan option is not specified /R implies /F.
/XPerforms a less vigorous check of index entries. /X applies to NTFS only.
/BRe-evaluates bad clusters on the volume. /B implies /R and only applies to NTFS volumes.
[/SCAN]NTFS only – Runs an online scan on the volume.

CHKDSK Examples

To find physical disk errors in the file system and attempt to recover data from any disk with bad sectors, run the command:



To run the previous command, you MUST open command prompt as administrator. Search for cmd, right-click and click Run as administrator.

command prompt commands: CHKDSK /F

Because I ran CHKDSK on a system volume (Drive C:), I received the message “chkdisk cannot run…”. To run CHKDSK on next reboot, enter Y. Then press Enter. Reboot your computer.

When I reboot my computer CHKDSK is scanning and repairing my drive.

To check your disks for errors without attempting to fix errors, run CHKDSK without any parameter.



This is one of the most ignored command prompt commands. CHKNTFS is as important as CHKDSK. The difference is that CHKNTFS displays or modifies the checking of disk at boot time while CHKDSK can run when the Operating System is running.


CHKNTFS volume […]
CHKNTFS /T[:time]
CHKNTFS /X volume […]
CHKNTFS /C volume […]    


If CHKNTFS is used without specifying parameters, it will show if the specified drive is dirty or scheduled to be checked on next reboot.

CHKNTFS Parameters

Parameters Description
volumeSpecifies the drive letter (then a colon), volume name or mount point.
/DRestores the computer to the default behavior; all drives are checked the next time the computer reboots. CHKNTFS will then run on all drives that are marked as dirty.
/T:timeChanges the AUTOCHK initiation countdown time to the specified amount of time in seconds. If time is not specified, displays the current setting.
/XUsed to define drives excluded from the default boot-time check.
/CSchedules a drive to be checked at boot time; CHKDSK will then run if the drive is dirty.

CHKNTFS Examples

To see the Autochk.exe initiation countdown time for a computer:


If you wish to modify the initiation countdown time for Autochk.exe to 30 secs:

command prompt commands


Used to manage disks, partitions, volumes, or virtual hard disks. DISKPART loads its own interface within cmd. For this reason, it does not operate like other command prompt commands.

DISKPART commands

DISKPART has a long lists of commands you can run. Below, I have listed the commands that you will need for most disk management tasks:

HELP: Displays all DISKPART commands.
LIST: Display a list of objects
SELECT: Shift the focus to an object – makes the object available for editing
RESCAN: Rescan your PC for new disks and volumes.
COMPACT: Attempts to reduce the physical size of a specified file.
ACTIVE: Mark the selected partition as active.
ASSIGN: Assigns a drive letter or mount point to the selected volume.
ATTACH: Attaches a virtual disk file.
DETACH: Detaches a virtual disk file.
CONVERT: Convert between different disk formats (FAT, FAT32, NTFS).
CREATE: Creates a volume, partition or virtual disk.
DELETE: Deletes an object.
EXTEND: Extend a volume.
FORMAT: Formats the selected volume or partition.

For a full list of all DISKPART commands, enter into DISKPART interface, then execute HELP. More on this later. You could also get the full list of DISKPART commands by clicking DiskPart commands.

To get into DISKPART command interface, execute the command below:


The DISKPART command prompt will load:

DISKPART interface

To lists all available commands, run the HELP command:


Once you get into DISKPART, run the LIST DISK command


This will display all available disks on your computer


Next, to work on disk 0, execute:


DISK 0 is now selected

command prompt commands - DISKPART - SELECT DISK

To view available partitions on disk 0, run this command:


To work on Partition 4, for example, run:

SELECT Partition 4

Below are the result of both commands:

command prompt commands

You can then DELETE the selected partition. I believe you get the gist now.


Formats a disk for use with Windows. Most people normally formats a disk using Disk Management. For administrators, using the FORMAT command may be necessary sometimes.


FORMAT has a long list of parameters. For this guide, I will stick to the commonly used parameters as shown in the syntax below:

FORMAT volume [/FS:file-system] [/V:label] [/Q] 

FORMAT Parameters

Parameters Description
volumeSpecifies the drive letter. Must specify a colon after drive letter. volume parameter may also specify mount point, or volume name.
/FS:filesystemSpecifies the type of the file system for format the drive for. Available options are FAT, FAT32, exFAT, NTFS, UDF and ReFS.
/V:label Specifies the volume label.
/Q Performs a quick format.

FORMAT Examples

To format the volume highlighted in the image below with NTFS file system, and a volume label “FORMAT-Test”, then perform a quick format, use the command:


To use the FORMAT command, you MUST open command prompt as Administrator.

From the previous command, the volume is now formatted.

When you click Enter to run the last command you will be asked to confirm. Enter Y, then press the Enter key. See the result of the command below:

The disk is formatted as NTFS with volume label “FORMAT-Test”

command prompt commands

Command Prompt Commands to Copy Files and Folders

In this category, I will discuss three commands: COPY, XCOPY and ROBOCOPY.


Copies one or more files to another location.

COPY Syntax

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ …]] [destination [/A | /B]]

Like some command prompt commands I discussed earlier in this guide, the COPY command has a lot of parameters. But I will only discuss the most relevant parameters. Below is a shortened syntax.

COPY <Source> <Destination> [/Y] 
COPY <Source> <Destination> /-Y  

Sponsored Content

COPY Parameters

Parameters Description
<Source>Specifies the file or files to be copied.
<destination>Specifies the directory and/or filename for the new file(s).
/YSuppresses prompting to confirm you want to overwrite a existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.

COPY Examples

To copy all files in the current directory to a new directory, use the command below:


In the last command, C:\COPY is the destination directory


Copies files and directories, including sub-directories. XCOPY has more advanced features than COPY.

XCOPY Syntax

Full syntax

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]                             [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J] [/EXCLUDE:file1[+file2][+file3]…]

Shortened version with mostly used parameters

XCOPY source [destination] [/A] [/M] [/D:m-d-y] [/EXCLUDE:file1[+file2][+file3]…] [/S] [/E] [/C] [/Y] [/-Y] 


To see a full list of all XCOPY parameters and what they do, run the command HELP XCOPY.

XCOPY Parameters

Parameters Description
sourceSpecifies the file(s) to copy.
destinationSpecifies the location and/or name of new files.
/ACopies only files with the archive attribute set, doesn’t change the attribute.
/MCopies only files with the archive attribute set, turns off the archive attribute.
/D:m-d-yCopies files changed on or after the specified date.
If no date is given, copies only those files whose source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]…]Specifies a string defining files to be excluded from being copied.
/SCopies directories and sub-directories except empty ones.
/ECopies directories and sub-directories, including empty ones.
/CIgnores errors and continues copying.
/YStops XCOPY prompting you to confirm for destination file to be overwritten.
/-Y/-Y parameter makes XCOPY to prompt confirmation for an existing destination file to be overwritten.

XCOPY Examples

If you automatically update a report you may want to copy report files that are have changed since a particular date. The command below will copy all files that have changed since May 20, 2019.

XCOPY  \BackReports \Current /D:05-20-2019


This is an even more advanced copy command.


ROBOCOPY <source> <destination> [file [file]…] [options]

ROBOCOPY Parameters

Parameters Description
<Source>Used to define the path to the source folder.
<Destination>This is the path to the destination folder or directory.
[file [file]Specifies the file or files to be copied. Wildcard characters (* or ?) are supported.
[options]Specifies options to be used with the ROBOCOPY command.

For a full list of all parameters, open command prompt and run the command below;


The command will return a comprehensive information about ROBOCOPY. Alternatively, click ROBOCOPY link to read about the command.

Command Prompt Commands for System Administration and Reporting

These set of command prompt commands are useful for advanced system administration. Here they are.


Used to to create, delete, query, change, run or end scheduled tasks on a local or remote system. To run SCHTASKS you require administrator privilege.


SCHTASKS /parameter [arguments]

SCHTASKS Parameter Lists

/CreateUse this parameter to create a new scheduled task.
/DeleteOpposite of /Create, the /Delete parameter deletes an existing scheduled task(s).
/QueryLists all available scheduled tasks.
/RunThis switch runs a specified scheduled task.
/ChangeChanges the properties of a specified scheduled task
/EndEnds a currently running scheduled task
/ShowSid Shows the security identifier corresponding to a scheduled task name.

To get help with how to use a parameter, enter SCHTASKS followed by the parameter. Then end with “/ ?”. For example, to learn how to use the /Create parameter, run the command below:

SCHTASKS /Create /?

This will give you a full list of all the [arguments] for the /Create parameter and how to use them.

Sponsored Content


To get a full list of all the scheduled tasks on your computer, use this command:


The result


This is one of the command prompt commands that I use very often. SYSTEMINFO displays operating system configuration information for a local or remote computer. Information displayed include service pack and patch levels.


SYSTEMINFO [/S system [/U username [/P [password]]]] [/FO format] [/NH]


/S systemUsed to specify a remote computer to connect to.
/U usernameSpecifies a user with admin privilege to connect to the remote computer and run commands.
/P [password]The password for the user specified with the /U parameter
/FO formatSpecifies the format in which the output is to be displayed. Acceptable values: TABLE, LIST or CSV.
/NHIf used, the output will not display the “Column Header” in the output. /NH is only valid if /FO is used and TABLE and CSV formats are specified.


To display system information for your computer and display output in a table, use this SYSTEMINFO command:


The output is not vert readable!

I may also display the result in a LIST format:


Gives a better result


Displays a list of all currently running processes in the local computer. It can also display processes in a remote computer.


TASKLIST [/S system [/U username [/P [password]]]] [/M [module] | /SVC | /V] [/FI filter] [/FO format] [/NH]

TASKLIST Parameters

The description of the parameters: /S system, /U username, /P [password], /FO format and /NH are the same for the same parameters in the SYSTEMINFO command. Please read about this parameters in SYSTEMINFO (opens in a new window/tab).

The remaining parameters for TASKLIST are described in the table below:

/M [module]Lists all tasks currently running processes using the given exe/dll name. If the module name is not specified all loaded modules are displayed.
/SVCDisplays services hosted in each process.
/VDisplays verbose task information – shows the tasks as they are being displayed.
/FI filterDisplays a set of tasks that match a given criteria specified by the filter.


To display currently running processes on your computer, run the command below.


Sponsored Content

command prompt commands

To export all running processes to CSV, use this command:


Here is what the CSV looks like

command prompt commands


Terminate tasks by process id (PID) or image name.


TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]

TASKKILL Parameters

Like TASKLIST, the description of the parameters: /S system, /U username and /P are the same for the same parameters in the SYSTEMINFO command. Please read about this parameter click SYSTEMINFO (opens in a new window/tab).

The parameter table below describes TASKKILL parameters that have not been described in this guide.

/FI filterUsed to apply a filter to select a set of tasks. Allowed filters: “*” to be used. ex. imagename eq acme*
/PID processidSpecifies the PID of the process to be terminated. You can use the TASKLIST command to get the PID of the process.
/IM imagenameSpecifies the image name of the process to be terminated. You can use wildcard ‘*’ to specify all tasks or image names.
/TThis parameter tells TASKKILL to terminate the specified process and any child processes started by the original process.
/FIf /F is used, it forcefully terminate the specified process.


Use TASKKILL with caution as terminating certain processes could make your Operating System unstable. Specifically, be careful with using wildcard “*”.


If you wish to terminate processes based on process ID, first run TASKLIST and pipe it to the MORE command.


To terminate processes with IDs 960, 996 and 936, use the command below

TASKKILL /PID 960 /PID  996 /PID 936 


Used to shutdown or restart a local or remote computer.


SHUTDOWN [/I | /L | /S | /SG | /R | /G | /A | /P | /H | /E | /O] [/Hybrid] [/Soft] [/FW] [/F] [/M \\Computer] [/T xxx] 

SHUTDOWN Parameters

/IThe /I switch displays Remote Shutdown GUI dialogue with options to specify remote computers to shutdown. The /I switch must be the first option in a SHUTDOWN command. See SHUTDOWN examples below.
/LLogs the computer off. This cannot be used with /M or /D options.
/SShutdowns the computer.
/SGShutdown the computer. On the next boot, restart any registered applications.
/RShutdown and restart the computer.
/GFull shutdown and restart the computer. After the system is rebooted, restart any registered applications.
/AAbort a system shutdown. This can only be used during the time-out period. Combine with /FW to clear any pending boots to firmware.
/PTurn off the local computer with no time-out or warning. Can be used with /D and /F parameters.
/HHibernate the local computer. Can be used with the /F switch.
/EDocument the reason for an unexpected shutdown of a computer.
/OGo to the advanced boot options menu and restart the computer.
Must be used with /R option.
/HybridPerforms a shutdown of the computer and prepares it for fast startup. Must be used with /S switch.
/FWCombine with a shutdown option (/S) to cause the next boot to go to the firmware user interface.
/FForce running applications to close without forewarning users. The /F parameter is implied when a value greater than 0 is specified for the /T parameter.
/M \\ComputerSpecify a target remote computer.
/T xxxSet the time-out period before shutdown to xxx seconds. Default is 30s with a max value of 315360000s (10 years).

Important Information

I left out /D [P|U:]xx:yy] and /C [“comment”] parameters as you may not need them often.


If you run SHUTDOWN without specifying any parameter, it will display help. Running SHUTDOWN without specifying any parameter is similar to typing “SHUTDOWN /?”.


To display a dialogue box with options to shutdown specified computers, simply use SHUTDOWN with /I switch:


Sponsored Content

When you execute SHUTDOWN /I [1], the Remote Shutdown Dialogue GUI opens [2]. To add computers, click Add [3], this opens the Computer Names box [4]. When you finish adding the computers, click Ok. Then Ok to shut them down.


This is another very important but often ignored command prompt commands. An administrator can use DRIVERQUERY to display a list of installed device drivers on a local or remote computer.


DRIVERQUERY [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/SI] [/V]


/SSpecifies a remote computer to connect to.
/U usernameUsed to specify a user name with permission to connect to the remote computer.
/P passwordSpecifies the password for the user above.
/FO formatSpecifies the type of output to display. Acceptable formats: “TABLE”, “LIST” or “CSV”, without the quotes.
/NHRemoves the column headers from the output.
/SIProvides information about signed drivers.
/VDisplays verbose output. Not valid for signed drivers.


To list all drivers on your computer and display the result in a tabular format, use the command below:


Here is the result

command prompt commands - DRIVERQUERY /FO TABLE

To add the information whether a driver is signed or not, include /SI switch to the previous command:


A new column, “IsSigned” is now included.


In the above result, if IsSigned is FALSE, it means the driver is NOT signed.

Command Prompt Commands for Managing Files and Folders

These sets of command prompt commands are used to rename, move or delete files and folders.


Renames a file or files. The short version of the command is REN.


RENAME [drive:][path] filename1 filename2.
REN [drive:][path] filename1 filename2.


RENAME command does not allow you to specify a new drive or path for your destination file.

RENAME Parameters

[drive:][path]filename1Specifies the location and name of the file or set of files you want to rename. FileName1 can include wildcard characters (* and ?).
filename2The new name of the file

RENAME Examples

In the image below, I want to rename the file TASKLIST-csv to New-CSV

Sponsored Content

Here is the command I used:


Here is the result:

 command prompt commands - RENAME command


Creates a directory or folder. Short version is MD.

MKDIR Syntax

MKDIR [drive:]path
MD [drive:]path

MKDIR Parameters

[drive:]Specifies the drive on which you want to create the new directory.
pathThis is a required parameter. It specifies the name and location of the new directory. The maximum length of any single path is determined by the file system (FAT, FAT32 or NTFS).

MKDIR Examples

To create a folder called MDTest in the path “C:\G-Drive\flatsome”, run the command below:

MKDIR C:\G-Drive\flatsome\MDTest  

The results:

MD command prompt command


The MOVE command moves files and folders (directories). It also renames files and folders.

MOVE Syntax

Syntax to rename a file

MOVE [/Y | /-Y] [drive:][path]filename1[,…] destination

Syntax to a directory (folder)

MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

MOVE Parameters

[drive:][path]filename1Specifies the location and name of the file or files you want to move.
destinationSpecifies the new location of the file.
[drive:][path]dirname1Specifies the directory you want to rename.
dirname2Specifies the new name for dirname1.
/YSuppresses prompting to confirm you want to overwrite an existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.


For the file destination parameter, destination can consist of a drive letter and colon, a directory name, or a combination of both. If you are moving only one file, and want to rename the file when you move it, you can also include a filename.

MOVE Examples

In this example, I want to rename MDTest (highlighted in the image below) to MDTest2

Here is the command:


Here is the result:


In the previous command, I did not need to specify the [drive:][path] because I wanted the command performed in the directory I was running the command from. The folder I was renaming was in the same directory.


This is the final in my ultimate list of command prompt commands. ERASE command deletes one or more files.

ERASE is the same as DEL command.


Use ERASE (DEL) with caution as the command may delete important Operating System files depending on how you use it. If you use DEL or ERASE to delete a file from your computer, you cannot retrieve the file.

ERASE (DEL) Syntax

ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names 

ERASE (DEL) Parameters

Parameters Description
/PAsks for confirmation before deleting each file.
/FForce deleting of files marked as read-only.
/SDelete specified files from all sub-directories.
/QQuiet mode, do not ask if ok to delete when global wildcard is used. If you use /Q switch, all files will be deleted without prompting your for confirmation. [Use with caution!]
/ASelects files to delete based on file attributes.
attributesSee below for acceptable attributes*.
namesSpecifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted.

*Acceptable attributes of the /A parameter:

R Read-only files
S System files
H Hidden files
A Files ready for archiving
I Not content indexed Files
L Reparse Points
– Prefix meaning not

ERASE (DEL) Examples

TO delete all files in the current directory but prompt you for confirmation, use the command:

ERASE /P *.*


*.* is a wildcard meaning delete every file in the current directory

When you press Enter key, for each file you will be asked to confirm with Y or N. Here is the result:

Sponsored Content


Here you have them – 20 very useful command prompt commands that every Windows System Admin should know. I hope you found them useful.

If you have any question or comment, use the “Leave a Reply” form at the end of this guide.

Alternatively, you can share your experience working with Windows command prompt commands.

Other Helpful Guides

Additional Resources and References

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

By using this website you agree to accept our Privacy Policy and Terms & Conditions