15 Useful Windows Command Prompt Commands and Tricks

A command prompt is the input field in a text-based user interface screen for an operating system or program. The command prompt consists of a brief text string followed by a blinking cursor, which is where the user types commands.

These commands are very useful, using that commands we can do file management, fix the disk bad sectors and issues, Scan the system etc.

How to access Command Prompt:

Go to Start Menu -> Search "Command Prompt" -> Select "Command Prompt" from search results.


CMD




Following are the some lists of commands with syntax and examples check it out:  

1.) PROMPT Command


Using PROMPT command you can change the Windows command prompt.  

Syntax: PROMPT [text]

text: Specifies a new command prompt.

Prompt can be made up of normal characters and the following special codes:

  $A   & (Ampersand)
  $B   | (pipe)
  $C   ( (Left parenthesis)
  $D   Current date
  $E   Escape code (ASCII code 27)
  $F   ) (Right parenthesis)
  $G   > (greater-than sign)
  $H   Backspace (erases previous character)
  $L   < (less-than sign)
  $N   Current drive
  $P   Current drive and path
  $Q   = (equal sign)
  $S     (space)
  $T   Current time
  $V   Windows version number
  $_   Carriage return and linefeed
  $$   $ (dollar sign)

Examples: 
prompt hello
prompt $D $G $N$P

return to default:

prompt

Prompt



2.) TITLE Command


This command sets the window title for a CMD.EXE session.

Syntax: title [text]

Example: title Welcome To Hell


title command



3.) SYSTEMINFO Command


This command displays machine specific properties and configuration. Using this command you can check the operating system info, network cards info, memory info etc.

Syntax: SYSTEMINFO 

Example: SYSTEMINFO 

Systeminfo command



4.) COLOR Command


This command sets the default console foreground and background colors. Also using some extra attributes you can change the colors too.

Syntax: COLOR [attr]

attr: Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground.  Each digit can be any of the following values:

    0 = Black        8 = Gray
    1 = Blue          9 = Light Blue
    2 = Green        A = Light Green
    3 = Aqua         B = Light Aqua
    4 = Red           C = Light Red
    5 = Purple       D = Light Purple
    6 = Yellow      E = Light Yellow
    7 = White        F = Bright White

Example: color 0A (This will change the text color to light green and background color to Black)

color command


5.) HELP Command


Help command provides help information for Windows commands.

Syntax: HELP [command name]

Example: 

HELP color (This will display color command all details)

HELP (This will list all the commands)


Help Command


6.) CLS Command           


CLS command clears the screen.

Syntax: CLS

Example: CLS


7.) Command History


Using this command, you can track down your command history. This will turn out to be useful when you are trying to look for some command that you’ve used in the past, but can’t remember.

Example: doskey /history


Doskey command



Also you can check previous commands using UP and DOWN arrow keys from your keyboard.


8.) Run multiple commands


Using "&&" operator you can run multiple commands in single line. If you are feeling the need to run two commands one after the other, you can do so easily. For example, here’s how to run ipconfig and help.

ipconfig && help

Run Multiple commands



9.) Send output to clipboard


Very often, you might have felt the need to save the output of a command? Usually, people use copy and paste. However, using a simple command, you can send the command's output to the Windows clipboard. 

Syntax: [command which you want to copy to clipboard] | clip

Here’s how to send the help information:

help | clip 

After that paste it anywhere.

Copy To Clipboard



10.) Abort a command


If you execute some command and you want to stop it than simply press Ctrl+C. This will abort the command. However, it isn't a magic trick that can undo an undoable thing.

11.) Scan system files for problems


The sfc /scannow command runs a system file checker tool that scans Windows system files and looks for problems. If some files are missing or corrupted, this command fixes them. Also make sure your are the administrator while execute this command otherwise it will not execute.

Example: sfc /scannow


SFC command



12.) Fix issues with DNS resolver cache


Dns flushing is the mechanism where the user can manually make all the entries in the cache invalid, so your computer re-fetches new combinations by now on whenever it needs and stores in local cache. 

To access websites faster, your computer usually maintains a local DNS resolver cache. But sometimes, the cache might get corrupt and you may not be able to access your favourite sites.

Using the following command you can flush the DNS

Command: ipconfig /flushdns

Ipconfig command


13.) Fix errors on disk


CHKDSK is a Windows utility that can check the integrity of your hard disk and can fix various file system errorsIt verifies the file system integrity of a volume and fixes logical file system errors.

Command: chkdsk /f


14.) DIR Command


DIR command displays a list of files and subdirectories in a directory.  

Command: DIR

DIR Command



15.)  See PC driver list


Using a simple command, you can see all the drivers installed on your computer. All you need to do is run the driverquery command, and you’ll be seeing a list of all the drivers along with their name, type, and other information.


Command: driverquery



Some other important points:

- If you want to change the drive simply just write drive name with colon and press enter. Here is the example:

Example: C:\Users\MW> G:

- If you want to change the directory than simply write cd [directory_name] command. CD is stand for change directory.

Example: CD Wallpaper


CD Command


- If you want to come out from the directory than used cd.. command. Here the the example:

Example: C:\Users\MW> cd..



That'it for now. If you have any questions or suggestions please let us know through below comment box.

Thanks!

Post a Comment

2 Comments