Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to tweak the cmd.exe to display the long names into the short one's like say example C:\Documents and Settings\ into C:\DOCUM~1

I know that it can done with command.exe , But it doesn't have the auto complete feature.

Is there any tweaks or tools to display the path like that using cmd.exe ?

share|improve this question
Do you mean the actual prompt, or the file listings? – invert Oct 13 '09 at 11:24
Actual Prompt , not the dir/file listing – ukanth Oct 13 '09 at 11:40
up vote 2 down vote accepted

AFAIK this is not possible, see this article that discusses every possible trick to do with the prompt of cmd.exe:

A better PROMPT for CMD.EXE or Cool Prompt Environment Variables and a nice transparent multi-prompt

As noted here, there are many cmd replacement shells which are more flexible.

share|improve this answer
I too think so , its not possible with cmd.exe – ukanth Oct 13 '09 at 11:45

I guess you mean, not command.exe.

There is no way to get the short filenames in cmd.exe in my opinion.

You could use TakeCommand Console LE. It's free and a replacement for cmd.exe with a lot of extra features. It supports autocompletion (with the TAB key) and short filenames.

They explain about it in the helpfile:

On LFN drives, TCC will search for and display long filenames during filename completion. If you want to search for 8.3 short filenames (SFNs), press Ctrl-A before you start using filename completion. This allows you to use filename completion on LFN drives with applications that do not support long filenames. The LFNToggle directive can be used to change the keystroke assigned to this feature.

You can press Ctrl-A at any time prior to beginning filename completion. The switch to SFN format remains is in effect for the remainder of the current command line. When TCC begins a new command line it returns to long filename format until you press Ctrl-A again.

You can also press Ctrl-A just after a filename is displayed, and the name will be converted to short filename format. However, this feature only affects the most recently entered file or directory name (the part between the cursor and the last backslash [] on the command line), and any subsequent entries. It will not automatically convert all the parts of a previously entered path.

Ctrl-A toggles the filename completion mode, so you can switch back and forth between long and short filename displays by pressing Ctrl-A each time you want to change modes.

share|improve this answer
I tried it , but still it everytime i can't press CTRL+A to change the directory name. – ukanth Oct 13 '09 at 11:47
Works fine for me. With the TAB key, select a directory with a long filename (\Program Files\ for instance). Press CTRL+A and the shortname is displayed instead. – Snark Oct 13 '09 at 12:24

It can't be done. The output of help prompt gives a list of what can be done:

Changes the cmd.exe command prompt.

PROMPT [text]

text Specifies a new command prompt.

Prompt can be made up 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 = (equal sign) $S (space) $T Current time $V Windows version number $_ Carriage return and linefeed $$ $ (dollar sign)

If Command Extensions are enabled the PROMPT command supports the following additional formatting characters:

$+ zero or more plus sign (+) characters depending upon the depth of the PUSHD directory stack, one character for each level pushed.

$M Displays the remote name associated with the current drive letter or the empty string if current drive is not a network drive.

It is possible to get this information in other CMD contexts, using the %~ syntax in call and for. For example, consider this script:

call :X "%CD%"
goto :EOF

:X echo %1 echo %~s1

Output is:

"C:\Documents and Settings"

See call /? and for /? for details.

It could come as no surprise that this is trivial in PowerShell. In PowerShell, the prompt doesn't have its own special syntax; it's a perfectly normal function. You can use

Get-ShortPath $PWD

share|improve this answer

To force short 8.3 filenames, use the dir command with the inverted /N option, like so:

dir /-N

Also I use Console a console enhancement, supports auto-complete too.

share|improve this answer

You must log in to answer this question.

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