Upper Case

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Squashman
Expert
Posts: 4470
Joined: 23 Dec 2011 13:59

Upper Case

#1 Post by Squashman » 19 Nov 2016 12:15

Did anyone ever notice that the FIND command upper cases your output? Was not sure if anyone ever documented this. Even when the file is not found it still upper cases the output.

Code: Select all

C:\Batch\SO>find /c /v "" fb.bat

---------- FB.BAT: 4

C:\Batch\SO>find /c /v "" params.bat
File not found - PARAMS.BAT

C:\Batch\SO>find /c /v "" params.txt

---------- PARAMS.TXT: 1

C:\Batch\SO>find /c /v "" C:\Batch\SO\null.txt

---------- C:\BATCH\SO\NULL.TXT: 0

ShadowThief
Expert
Posts: 1162
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Upper Case

#2 Post by ShadowThief » 19 Nov 2016 12:27

Interestingly, it doesn't seem to stay upper case when there's an asterisk involved.

Code: Select all

E:\hawk\Documents\Code\batch\>find /c /v "" "hi*2"
File not found - "hi*2"


It's fine with regular non-files, though.

Code: Select all

E:\hawk\Documents\Code\batch\passgen>find /c /v "" "hifive"
File not found - HIFIVE

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

Re: Upper Case

#3 Post by aGerman » 19 Nov 2016 13:41

We already developed a function using FC.
viewtopic.php?t=5167#p30643
Maybe the line feed trick works here, too. (I didn't test it yet ...)

Steffen

Squashman
Expert
Posts: 4470
Joined: 23 Dec 2011 13:59

Re: Upper Case

#4 Post by Squashman » 19 Nov 2016 16:25

ShadowThief wrote:Interestingly, it doesn't seem to stay upper case when there's an asterisk involved

Well that pretty much kills that idea.

Squashman
Expert
Posts: 4470
Joined: 23 Dec 2011 13:59

Re: Upper Case

#5 Post by Squashman » 19 Nov 2016 17:43

Well looks like we can force it to upper case with an Asterisk in certain situations. I am not sure if the last example will be fool proof or not.

Code: Select all

C:\Batch\SO>find /c /v "" C:\Batch\S*O\null.txt
File not found - C:\BATCH\S*O\NULL.TXT

C:\Batch\SO>find /c /v "" C:\Batch\SO\null*.txt

---------- C:\BATCH\SO\NULL.TXT: 0

C:\Batch\SO>find /c /v "" C:\Batch\SO\notme*.txt
File not found - C:\Batch\SO\notme*.txt

C:\Batch\SO>find /c /v "" C:\Batch\SO\notme*.txt\
File not found - C:\BATCH\SO\NOTME*.TXT\


I will answer my own question. Failure with two many quotes.

Code: Select all

C:\Batch\SO>find "" "!^&:C:|>>""\notm*?e.txt\!"
File not found - !^&:C:|>>\NOTM*?E.TXT\!

C:\Batch\SO>find "" "!^&:C:|>>"\notm*?e.txt\!"
FIND: Parameter format not correct


But this was interesting.

Code: Select all

C:\Batch\SO>find "" "!^&:C:|>>""\notm*?e.txt\!"
File not found - !^&:C:|>>\NOTM*?E.TXT\!

C:\Batch\SO>find "" "!^&:C:|>>"."\notm*?e.txt\!"
File not found - !^&:C:|>>.
File not found - \NOTM*?E.TXT\!

C:\Batch\SO>find "" "!^&:C:|>>",\notm*?e.txt\!,bl,ah
File not found - !^&:C:|>>,\NOTM*?E.TXT\!,BL,AH

So FIND is stripping the quotes no matter where they are.

Post Reply