Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The windows command line prompt display the full path of the currently directory, which will be too long when I am deep into a directory, like:

V:\Runtimes\ProjectName\src\ToolsTest\JavaCrashExample\JavaCrash\main\ToolsTest\JavaCrashExample\JavaCrash>

Is their any way to customized this, so that I can just display the current directory's name?

Thanks.

share|improve this question

migrated from stackoverflow.com Oct 18 '11 at 2:19

This question came from our site for professional and enthusiast programmers.

    
As an alternative you can also look at a CMD.exe replacement: stackoverflow.com/questions/19772/cmd-exe-replacement. –  Wimmel Oct 17 '11 at 8:57
    
I haven't found how to get the current folder name only, but you can cut it back to just > by typing Prompt $g –  Hand-E-Food Oct 18 '11 at 3:20
add comment

4 Answers

up vote 2 down vote accepted

See this. You might also take a look at PowerShell.

The question itself belongs elsewhere, though.

share|improve this answer
    
Thanks, but seems we don't have an option to display the current folder name? –  lzprgmr Oct 17 '11 at 7:20
    
@lzprgmr the $P option displays the current drive and path (folder name). There is no way to display only the current directory name though –  Nate Koppenhaver Oct 18 '11 at 3:09
add comment

You can use the prompt command, which changes the displayed prompt.
Type prompt /? and you will get this:

C:\>PROMPT /?
Changes the cmd.exe command prompt.

PROMPT [text]

    text    Specifies a new command prompt

Prompt can be made of normal characters and the following special codes:

    $A    & (Ampersand)
    $B    | (Pipe)
    $C    ( (Left parenthesis)
    $D    Current date
    $E    Escape code (ASCII code 27)
    $F    ) (Right parenthesis)
    $G    > (Greater-than sign)
    $H    Backspace (erases previous character
    $L    < (Less-than sign)
    $N    Current drive
    $P    Current drive and path
    $Q    = (Equals sign)
    $S      (Space)
    $T    Current time
    $V    Windows version
    $_    Carriage return and linefeed
    $$    $ (Dollar sign)

If command extensions are enabled, there are a few more options, but these are the relevant ones.

In case you were wondering, the default prompt is: prompt $P$G,
and a BASH style prompt is: prompt $$.

The one that I use when I'm working in long directories is prompt $G, which is simply '>'.

Although there is no way to display just the current folder, you can always use dir to display folder information, including the path

share|improve this answer
add comment

In the command prompt, type: prompt /?

That will give you a list of the options for customizing your prompt. There doesn't appear to be an option for displaying only the current directory name.

share|improve this answer
add comment

prompt $n$g at least gives the drive letter (e.g. "C>"), but I haven't found just the current folder. "cd" (without parameters) is a better command for displaying the current directory that "dir", much like pwd (print working directory) in other OS's.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.