The Windows Command Prompt (cmd) shows a default prompt like C:\> that tells you the current drive and folder. You can change this prompt temporarily for the current session or permanently for all future sessions using the prompt command or system settings. The method differs slightly between a temporary change and a permanent one.
Change the prompt for the current session only
This change lasts until you close the Command Prompt window. It is useful for testing or when you want a custom prompt for a specific task.
- Open Command Prompt by pressing Win + R, typing
cmd, and pressing Enter. - Type
prompt $gand press Enter to set the prompt to a simple greater-than sign (>). - Try other codes:
prompt $p$grestores the default (folder path followed by >),prompt $t $gshows the current time, andprompt hello $gdisplays 'hello >'. - To see all available codes, type
prompt /?and press Enter.
Make the prompt change permanent for all future sessions
This sets the prompt every time you open Command Prompt, so you do not need to re-enter the command each time.
- Press Win + Pause to open System Settings, or right-click Start and choose System.
- Click 'Advanced system settings' on the right, then click the 'Environment Variables…' button at the bottom.
- Under 'User variables' (for your account only) or 'System variables' (for all users), click 'New…'.
- Enter
PROMPTas the variable name and your desired prompt string as the value, for example$p$gfor the default or$t $gto show the time. - Click OK on all open windows to save the changes.
- Open a new Command Prompt window to see the updated prompt.
Where it fits: common mistakes and what each one causes
- Using
set PROMPT=...instead ofpromptor environment variables: This does not affect the Command Prompt display; only thepromptcommand or PROMPT environment variable changes the prompt. - Setting the PROMPT variable under System variables without admin rights: This may fail silently; use User variables instead if you lack administrator privileges.
- Including unsupported characters in the prompt string: Some special characters may cause display issues or be ignored; stick to the documented
promptcodes like $p, $g, $t, $d. - Forgetting to open a new Command Prompt after making a permanent change: The change only applies to new windows; existing sessions retain the old prompt until restarted.
Before-you-start checklist
- You have access to a Windows computer with Command Prompt available.
- You know whether you want a temporary change (current session only) or a permanent one (all future sessions).
- You have decided what prompt format you want, such as showing time, path, or custom text.
- You can access System Properties via Win + Pause or the Start menu.
Symptom / cause / fix table for when it goes wrong
| Symptom | Cause | Fix |
|---|---|---|
Prompt does not change after typing prompt |
Command typed with a typo or unsupported code | Retype the command carefully; use prompt /? to verify valid codes |
| Prompt reverts to default after closing and reopening cmd | You made only a temporary change, not a permanent one | Set the PROMPT environment variable as described in the permanent change steps |
| New Command Prompt still shows old prompt after setting PROMPT variable | Variable set under System variables without sufficient permissions, or typo in value | Use User variables instead, or double-check the variable name and value for accuracy |
| Prompt shows strange characters or does not display correctly | Unsupported or conflicting characters in the prompt string | Use only documented prompt codes ($p, $g, $t, $d, $_ etc.) and avoid raw special characters |
An Example of useful prompt formats
Here are practical examples you can copy directly into the prompt command or PROMPT variable:
prompt $p$g– Standard format: shows current drive and path followed by > (e.g., C:\Users\Name>)prompt $t $g– Shows current time: (e.g., 14:30:00.50 >)prompt $d $s$t$g– Shows date and time: (e.g., Mon 05/20/2024 14:30:00.50 >)prompt [$_$p]$_$g– Path in brackets on its own line, then > on new line: (e.g., [C:\Users\Name]\n>)prompt $n$g– Shows only the computer name: (e.g., DESKTOP-ABC123>)
How to check if your prompt change worked
- After making a temporary change, look at the prompt line immediately after pressing Enter on the
promptcommand. - After making a permanent change, close all Command Prompt windows and open a new one.
- Verify the prompt displays exactly as you set it, based on the codes used.
- If it does not match, repeat the steps and check for typos in the command or variable value.
Related
- High Performance Mode via CMD Prompt
- High Performance Mode in a Command Prompt: What It Really Means
- How to Write a High School Drama Synthesis Prompt
General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more
Spotted an error? Tell us and we will correct it (corrections policy).