How do I hide the path in command line prompt on Windows?

40,390

Solution 1

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

Solution 2

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 "".

Solution 3

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.

Share:
40,390

Related videos on Youtube

Калин Димитров
Author by

Калин Димитров

Updated on September 18, 2022

Comments

  • Калин Димитров
    Калин Димитров over 1 year

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

    • Калин Димитров
      Калин Димитров almost 13 years
      real-estate ...
    • soandos
      soandos almost 13 years
      Sorry, dont follow. You mean you want to see more on the screen?
    • cularis
      cularis almost 13 years
      That's what he means, exactly.
    • barlop
      barlop almost 13 years
      -1 extremely badly worded, and maybe not even the best thing to do if you're bothered by a long current directory. A better thing might be prompt $p$_$g. So you still are reminded of the current directory but it's not in the way. And if you did want to hide the current directory, then it's not hiding the path it's hiding the current directory. And of course it can still be seen by CD if you meant hiding it from people. Your question is pretty bad. And adding the comment about "real-estate" shows no care to ensure clarity, and no ability to use proper terms, and no care about using proper terms
    • dsolimano
      dsolimano almost 13 years
      @barlop, I believe real estate is a fairly standard way to refer to the space available on the screen - e.g. bing.com/…
    • JdeBP
      JdeBP over 12 years
  • Калин Димитров
    Калин Димитров almost 13 years
    I feel FREE!!!!
  • Chris Moutray
    Chris Moutray over 9 years
    Is there a way to make this stick ie become default?
  • Pramesh Bajracharya
    Pramesh Bajracharya almost 7 years
    This should be the accepted answer. Thanks @Ben N
  • PandaWood
    PandaWood almost 3 years
    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
    PandaWood almost 3 years
    typing setx PROMPT $g$s gives me ERROR: Invalid syntax. Type "SETX /?" for usage.
  • Ben N
    Ben N almost 3 years
    @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.