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

25

9

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

Chris

Posted 2011-07-26T16:37:33.077

Reputation: 949

why do you want to? – soandos – 2011-07-26T16:38:36.270

real-estate ... – Chris – 2011-07-26T16:40:25.803

Sorry, dont follow. You mean you want to see more on the screen? – soandos – 2011-07-26T16:41:30.247

2That's what he means, exactly. – cularis – 2011-07-26T17:01:42.073

-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 – barlop – 2011-07-26T17:58:32.037

2

@barlop, I believe real estate is a fairly standard way to refer to the space available on the screen - e.g. http://www.bing.com/search?q=screen+real+estate&form=OPRTSD&pc=OPER

– dsolimano – 2011-07-26T19:24:35.520

@dsolimano well he could've put that in his question, and anyhow, one can increase the size of the window if they want more "real-estate". and he meant current directory. he could've been specific and said the issue he has is when typing after the long prompt, the text wraps too soon when he's in a directory with a long path, so he wants to make the prompt smaller, so space -there-. All he asked in his question about was "hiding the path" well that could be hiding the PATH variable. It's a very badly worded question. very cavalier – barlop – 2011-07-26T19:35:47.753

possible duplicate of Stopping command prompt from showing current directory in windows XP?

– JdeBP – 2011-11-28T20:15:26.113

Answers

57

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

Mehper C. Palavuzlar

Posted 2011-07-26T16:37:33.077

Reputation: 51 093

3Is there a way to make this stick ie become default? – Chris Moutray – 2014-08-20T13:36:43.850

7I feel FREE!!!! – Chris – 2011-07-26T17:09:12.440

7

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

Ben N

Posted 2011-07-26T16:37:33.077

Reputation: 32 973

1This should be the accepted answer. Thanks @Ben N – Pramesh Bajracharya – 2017-06-27T03:12:09.437

6

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.

Jack

Posted 2011-07-26T16:37:33.077

Reputation: 161