What's the ^ command line symbol for?

A

andrea

Hi all,
I have a question about the Windows command line interpreter:

The ? symbol replaces one character with boolean true, the * symbol replaces
one sequence of characters with boolean true, but what does the ^ symbol do?

Just try to run these commands and you'll see it must have a special meaning:
ECHO ^
ECHO ^^
ECHO ^^^
ECHO ^^^^

same on filenames. If a file contains ^ in its name, I am forced to specify
it between quotes even if it doesn't contain any space!

Thanks,
Andrea
 
A

Ayush

[[email protected]] wrote-:
Hi all,
I have a question about the Windows command line interpreter:

The ? symbol replaces one character with boolean true, the * symbol replaces
one sequence of characters with boolean true, but what does the ^ symbol do?

Just try to run these commands and you'll see it must have a special meaning:
ECHO ^
ECHO ^^
ECHO ^^^
ECHO ^^^^

same on filenames. If a file contains ^ in its name, I am forced to specify
it between quotes even if it doesn't contain any space!

^ is the escape char. For example, if you want to echo "&", you cannot run:
Echo &
because & is a special char to separate commands. But you can use ^ char to escape it:
Echo ^&

Good Luck, Ayush.
 
P

Pegasus \(MVP\)

Hi all,
I have a question about the Windows command line interpreter:

The ? symbol replaces one character with boolean true, the * symbol
replaces
one sequence of characters with boolean true, but what does the ^ symbol
do?

Just try to run these commands and you'll see it must have a special
meaning:
ECHO ^
ECHO ^^
ECHO ^^^
ECHO ^^^^

same on filenames. If a file contains ^ in its name, I am forced to
specify
it between quotes even if it doesn't contain any space!

Thanks,
Andrea

Not only is ^ the escape character but it is also the line continuation
character. When you type
echo ^
then Windows expects to get a further line of text. Thus the lines

echo My name is ^
echo Andrea

will generate the line "My name is Andrea" on the screen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top