tags:

views:

42

answers:

2

In a DOS window, how can I get the full DOS name / short name of the directory I am in?

For example, if I am in the directory "C:\Program Files\Java\jdk1.6.0_22", I want to display it's short name "C:\PROGRA~1\Java\JDK16~1.0_2".

I know running dir/x will give me the short names of files / directories in the current directory but I haven't been able to find a way to display the full path of the current directory in short name format. I'm having to work my way through the path from the root, directory by directory, running dir/x in each.

I'm sure there is an easier way to do this?

A: 

run cmd.exe and do the following:

> cd "long path name"
> command

Then command.com will come up and display only short paths.

source

gulbrandr
Windows 7 does not have command.com, at least not in the x64 version.
Timbo
+2  A: 
for %I in (.) do echo %~sI

Any simpler way?

Timbo
Perfect, thank you.
dairemac