Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#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: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
#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
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#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: 4486
- Joined: 23 Dec 2011 13:59
#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.