What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Command Prompt is more than a place to run ipconfig and ping. Its prompt, colors, window title, directory output, keyboard macros, and completion behavior can all be customized with built-in commands.

These tricks work in Windows 10, Windows 11, and Windows Server 2016, 2019, 2022, and 2025. Most changes apply only to the current cmd.exe window unless you save or configure them separately.

1. Turn the prompt into a two-line clock

The prompt command controls the text displayed before each command. This version puts the date and time on one line and the command prompt on the next:

prompt $d$s$s$t$_$g

The result resembles:

06/15/2025 14:37:22.45
>

Here is what each code does:

Code Meaning
$d Current date
$t Current time
$_ Carriage return and line feed
$s A space
$g The > character

Other useful prompt codes include $p for the current drive and path, $v for the Windows version number, $n for the current drive, $+ for the depth of the pushd stack, and $m for the network name associated with the current drive.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical alternative is:

prompt $p$_$g

That shows the current path on its own line and leaves the command entry below it. Be aware that including $p makes Windows query the drive and path after every command, which may be noticeable on slow or network drives.

To restore the normal prompt for the current session, run prompt with no argument. Prompt changes normally disappear when you close the window. To make a customized prompt appear automatically, place the command in a startup script or configure it through a suitable cmd.exe AutoRun setting.

2. Give the console a different color scheme

You can change the current Command Prompt window with the color command:

color e

This changes the foreground to light yellow and restores the default background. To try a red-on-gray combination, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

color 84

Microsoft’s documentation has an inconsistency here: its parameter description says the first digit is the foreground and the second is the background, but its color 84 example describes gray as the background and red as the foreground. The example matches the conventional Windows color behavior, so test a combination in your own console rather than relying on that contradictory sentence.

The available hexadecimal values are:

Value Color Value Color
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

Do not use identical digits such as color 77. Microsoft documents that this sets ERRORLEVEL to 1 and does not change the colors.

To return to the default foreground and background, run color with no argument.

For a persistent default rather than a temporary session change, open the Command Prompt window menu by selecting its upper-left corner, choose Defaults, open Colors, and select Screen Text and Screen Background.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Rename the Command Prompt window

A custom title makes it easier to identify several open consoles, especially when one is running a long task:

title Download Test

The syntax is title [<string>]. The title stays in place until another title command changes it. It does not automatically revert when the command that launched a task finishes.

This is useful in a batch file:

@echo off
title Processing Files
rem commands here
title Command Prompt

Put the first title near the beginning of the script, then explicitly restore the title at the end if the window will remain open. You can also use descriptive titles such as title Backup – C Drive or title Server Maintenance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Draw a directory as a tree

Instead of viewing a directory one level at a time with dir, use tree to display its hierarchy:

tree

With no drive or path specified, the command starts in the current directory on the current drive. These variations are useful:

tree C:\
tree C:\ /f
tree C:\ /f /a
tree C:\ /f | more

  • /f includes files as well as folders.
  • /a uses plain text characters instead of graphic line-drawing characters, which is useful when copying output into a basic text file.
  • | more pauses the output page by page so a large tree does not immediately scroll away.

To save a text version for inspection or sharing:

tree C:\ /f /a > C:\tree.txt

The destination directory must already exist. A scan of the root of the system drive can be very large, and protected folders may produce access-denied messages or incomplete output. For a more manageable result, start with a project directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

tree C:\Users\YourName\Documents\Project /f /a | more

Contrary to a common outdated explanation, tree is not limited to folders. The /f switch explicitly adds files.

5. Create your own Command Prompt shortcuts with doskey

doskey can create command-line macros for the current console session. For example:

doskey ll=dir /w
ll

Typing ll now runs dir /w, giving you a wide directory listing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use $t to separate multiple commands and $* to pass arguments typed after the macro name:

doskey tx=cd temp$tdir /w $*
tx
tx /p

The first command changes to the temp directory and then runs dir /w. The second example passes /p to the replacement command.

Positional parameters from $1 through $9 are also available:

doskey mc=md $1$tcd $1
mc Books

mc Books creates a directory named Books and changes into it. A macro is recognized only when its name starts at the first position of the command line. If you insert a leading space, Command Prompt runs the actual command name instead of the macro.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These macros are session-based. To save the current macros and reload them later:

doskey /macros > macinit
doskey /macrofile=macinit

Do not put a doskey macro in a batch file expecting the batch file to invoke it. Microsoft states that a doskey macro cannot be run from a batch program. For repeatable automation, use a batch file or another script instead.

There are also useful history keys:

Key Action
F7 Opens a numbered command-history dialog
F8 Searches for commands beginning with the text currently entered
F9 Selects a command by its history number
Alt+F7 Clears the current history buffer

Interactive programs can take over these keys, so they may not behave normally while such a program has control of the console.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Enable live variables and better path completion

Start a new Command Prompt process with delayed expansion and enhanced file and directory completion enabled:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cmd /v:on /f:on

The two switches do different jobs:

  • /v:on enables delayed environment-variable expansion. Variables written as !Variable! are expanded when a command executes.
  • /f:on enables file and directory completion for that cmd.exe process.

Delayed expansion matters inside parenthesized blocks and loops. Ordinary percent-style variables can be expanded when the whole block is parsed, before each command runs. With delayed expansion, !var! is evaluated at execution time instead.

For example, a loop can read a value that changes during the loop rather than repeatedly using an earlier parsed value. The trade-off is that literal exclamation marks can be altered or lost in commands running with delayed expansion enabled.

With /f:on, use these keys while entering a path:

Key Action
Ctrl+D Cycles through matching directory names
Ctrl+F Cycles through matching file and directory names
Shift+Ctrl+D Cycles backward through matching directories
Shift+Ctrl+F Cycles backward through matching files and directories

Quotation marks are required when completing paths containing spaces or special characters. Completion also discards text to the right of the cursor when you invoke it, so use it at the point where you want the match inserted. If there are no matches, the console beeps and leaves the command line unchanged.

FAQ

Do these Command Prompt tricks work on Windows 11?

Yes. Microsoft’s current command references list these commands and options for Windows 11, Windows 10, and Windows Server 2016, 2019, 2022, and 2025.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I reset the Command Prompt prompt and colors?

Run prompt to restore the default prompt and color to restore the default foreground and background for the current session.

Are Command Prompt customizations permanent?

Usually not. Prompt, color, title, and doskey changes generally affect the current console session. Save doskey macros to a file, or use a startup script or AutoRun configuration when appropriate.

Why does my doskey macro not work?

The macro name must begin at the first position on the command line. A leading space prevents macro matching. Also, doskey macros cannot be invoked directly from a batch program.

The Bottom Line

Try prompt $d$s$s$t$_$g for a timestamped two-line prompt, title for identifiable windows, tree C:\ /f /a for a shareable folder map, and doskey for session shortcuts. Use cmd /v:on /f:on when scripting requires live variables or faster path completion. These are small changes, but they make a plain Command Prompt window considerably more personal and useful.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.