33

I'm working on Windows 7 using the cmd console. How do I hide the path in the prompt?

8

3 Answers 3

66

You can use

prompt [text]

command. Type prompt /? to list all of the available parameters. For example, the following command sets "> (greater-than sign)" as prompt.

prompt $g
3
  • 10
    I feel FREE!!!!
    – Chris
    Jul 26, 2011 at 17:09
  • 3
    Is there a way to make this stick ie become default? Aug 20, 2014 at 13:36
  • Does this all need admin rights? When I type prompt on the Windows10 machine I'm on now, it just prints the prompt out twice and does nothing. Doesn't matter what I type after it ... /? $g ...makes no difference
    – PandaWood
    May 25, 2021 at 23:00
10

The command prompt $g will indeed set the prompt to a single > sign. For a full list of special codes you can use there, see prompt /?.

If you want the custom prompt to apply automatically when you start a command prompt, you can set the PROMPT environment variable. That can be accomplished in the normal Windows UI, or by using the setx command. For example, this sets the prompt to :

setx PROMPT $g$s

On the next launch of the command prompt, you'll see your new prompt.

To restore the normal Windows prompt for one session, type prompt. To restore the default for all sessions by removing the environment variable, type setx PROMPT "".

3
  • 1
    This should be the accepted answer. Thanks @Ben N Jun 27, 2017 at 3:12
  • typing setx PROMPT $g$s gives me ERROR: Invalid syntax. Type "SETX /?" for usage.
    – PandaWood
    Jun 1, 2021 at 0:55
  • @PandaWood Make sure to run that in a classic command prompt (CMD) instead of PowerShell. The dollar signs indicate a PowerShell variable. Also please note that the PROMPT environment variable only affects CMD, not the PowerShell prompt.
    – Ben N
    Jun 1, 2021 at 13:03
8

Some more tips:

If you want to go back to previous status (showing full path), just type prompt without any arguments, and press Enter. If you just want to see current working directory (the same as pwd in linux), type chdir or cd without any arguments and press Enter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .