Displayed case of drive letter can vary

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Displayed case of drive letter can vary

#1 Post by dbenham » 14 Jan 2012 11:43

Code: Select all

C:\Users>cd c:\

c:\>cd users

c:\Users>cd
c:\Users

c:\Users>for %a in ("%cd%") do @echo %~fa
c:\Users

c:\Users>cd C:\

C:\>cd users

C:\Users>cd
C:\Users

C:\Users>for %a in ("%cd%") do @echo %~fa
C:\Users

I was startled to see this behavior with regard to the displayed case of the drive letter. Given that the path is always displayed with the case used in the actual folder name, I assumed the drive letter would display either all upper or all lower. (I assumed all upper)

I ran this in Vista.
Has it always been like this :?: Are there any versions that act differently :?:

I can't remember for sure how DOS worked, but it seems like it was always upper case...
or I could be crazy...

or both could be true :lol:

Dave Benham

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: Displayed case of drive letter can vary

#2 Post by Liviu » 14 Jan 2012 15:12

dbenham wrote:I ran this in Vista.
Has it always been like this :?: Are there any versions that act differently :?:

Confirmed in Vista x64 (biz) and Win 7 x86 (pro), both at the regular and elevated cmd prompts.

XP (pro) has it always uppercase, though. Funny, indeed.

Liviu

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Displayed case of drive letter can vary

#3 Post by aGerman » 14 Jan 2012 19:46

You will find the same effect with DIR

Code: Select all

dir c:\

Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: xxxx-xxxx

Verzeichnis von c:\

etc.

Regards
aGerman

Post Reply