^ is a special character, to CMD

Off-topic posts of interest to the "Everything" community.
Post Reply
therube
Posts: 4972
Joined: Thu Sep 03, 2009 6:48 pm

^ is a special character, to CMD

Post by therube »

^ (caret, aka circumflex) is a special character, to CMD


say you want to print a directory listing to a file named "abc^123"

DIR > abc^123

with that, you end up with a file name of "abc123" (no ^)

^ acts as an ESCAPE character (or, as a continuation character)

so, if you want to output a directory listing to a file named "abc^123"
you have to escape things in some way to effect that

DIR > "abc^123"
DIR > abc^^123

in the second case, ^^ escapes the escape (^), so you end up with a literal ^


in the same way, if you pass a literal file name that contains a ^ to Everything,
you have to escape it, in some way

Everything.exe abc^123, does a search for "abc123" (no ^)
Everything.exe -s abc^123, does a search for "abc123" (no ^)

oddly, even though -s* should then be treating abc^123 as a literal, it does not work here?
Everything.exe -s* abc^123, does a search for "abc123" (no ^)


Everything.exe "abc^123"
Everything.exe abc^^123
the above will work, searching for "abc^123"

wildcards also work
Everything.exe a*
Everything.exe ab*

but not

Everything.exe ab^*


Maybe there should be a Character entities:
  • &carat:

likewise, an external program may CALL Everything
so FileManager -> CALL Everything.exe %listoffiles%

the CALL is "CMD", hence the above applies
so if %listoffiles% happens to contain a ^ in the name
& if the name is not escaped (like by enclosing in quotes)
a wrong file name will be passed to Everything (a name sans the ^)

if FileManager did not "CALL" Everything, but instead "invoked" Everything, directly
no CALL, hence no "CMD" is involved, so %listofnames% can simply be a "list of names"
& escaping (like by enclosing in quotes) would not be necessary (particularly)

FileManager -> Everything.exe %listoffiles%


superuser: What does ^& represent in Windows command line?
void
Developer
Posts: 16723
Joined: Fri Oct 16, 2009 11:31 pm

Re: ^ is a special character, to CMD

Post by void »

CMD will unescape ^ before anything is passed to Everything.

You can check the command line Everything receives under Help -> Troubleshooting information.



#hat: can be used to escape ^

#hat:
Post Reply