Rock Wang
Rock Wang

Reputation: 127

With Windows cmd or Cygwin, Is there a way to get the actually file path/name with proper case?

Is there a way, using Windows cmd or Cygwin, to get the actually file path/name with proper case? For example,

Input:

c:\windows\system32\display.dll

Output

C:\Windows\System32\Display.dll

Upvotes: 1

Views: 179

Answers (1)

jeb
jeb

Reputation: 82390

You can use a FOR /F to echo or fetch the case corrected filename

for /F "delims=" %%X in ("c:\windows\system32\display.dll") do echo %%~fX

The case of the drive letter seems to be undetermined.
It can be upper or lower case for the same drive.
I tested it with

c:\> pushd C:\
C:\> popd
c:\> pushd c:\
c:\>

So you can simply force the drive letter to be always in lower case.

Upvotes: 6

Related Questions