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

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


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.