Sign in with
Sign up | Sign in
Your question

When did ^ become special on the command line?

Last response: in Windows XP
Share
Anonymous
April 10, 2005 7:36:39 PM

Archived from groups: microsoft.public.windowsxp.customize (More info?)

In versions of the command prompt like Win98, the ^ (caret or
circumflex, ASCII 94) is just an ordinary character. In the XP
command prompt it's the escape that causes the following character
to be ordinary. Example:

echo P(A^|B) is the conditional probability of A given B

My question is, with which version of Windows did ^ become special?
And is there some environment variable I can test that was created
or changed at the same time?

I need to do something like this, in other words:

set CARET=^^
if "%...%" = "..." set CARET=^

but I don't know how to test reliably for which versions of Windows
do (or don't) make the caret special.

--

Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/

More about : special command line

April 10, 2005 7:36:40 PM

Archived from groups: microsoft.public.windowsxp.customize (More info?)

See the book "Microsoft Windows Command-Line" ISBN 0-7356-2038-5 for
answers.

"Stan Brown" <the_stan_brown@fastmail.fm> wrote in message
news:3btdhvF6jrer7U26@individual.net...
> In versions of the command prompt like Win98, the ^ (caret or
> circumflex, ASCII 94) is just an ordinary character. In the XP
> command prompt it's the escape that causes the following character
> to be ordinary. Example:
>
> echo P(A^|B) is the conditional probability of A given B
>
> My question is, with which version of Windows did ^ become special?
> And is there some environment variable I can test that was created
> or changed at the same time?
>
> I need to do something like this, in other words:
>
> set CARET=^^
> if "%...%" = "..." set CARET=^
>
> but I don't know how to test reliably for which versions of Windows
> do (or don't) make the caret special.
>
> --
>
> Stan Brown, Oak Road Systems, Tompkins County, New York, USA
> http://OakRoadSystems.com/
Anonymous
April 10, 2005 7:59:15 PM

Archived from groups: microsoft.public.windowsxp.customize (More info?)

Windows NT4.x . Maybe earlier.

The caret ^ Treats the next symbol as a character.

[[To display a pipe (|) or redirection character (< or >) when you are using
echo, use a caret character immediately before the pipe or redirection
character (for example, ^>, ^<, or ^| ). If you need to use the caret
character (^), type two (^^). ]]
Echo
http://www.microsoft.com/resources/documentation/window...

[[Fourth, all reserved shell characters not in double quotes must be
escaped. These characters have special meaning to the Windows NT command
shell. The reserved shell characters are:

& | ( ) < > ^

To pass reserved shell characters as part of an argument for a command,
either the entire argument must be enclosed in double quotes, or the
reserved character must be escaped. Prefix a reserved character with a carat
(^) character to escape it. For example, the following command example will
not work as expected, because < and > are reserved shell characters:

1. C:\>echo <dir>
2. The syntax of the command is incorrect.

Instead, escape the two reserved characters, as follows:

1. C:\>echo ^<dir^>
2. <dir>

Typically, the reserved shell characters are not used in commands, so
collisions that require the use of escapes are rare. They do occur, however.
For example, the popular PKZIP program supports a -& switch to enable disk
spanning. To use this switch correctly under Windows NT, -^& must be typed.

Tip The carat character is itself a reserved shell character. Thus, to type
a carat character as part of a command argument, type two carats instead.
Escaping is necessary only when the normal shell interpretation of reserved
characters must be bypassed.]]
The Windows NT Command Shell
http://www.microsoft.com/technet/prodtechnol/winntas/de...

See also... Windows NT Batch File and Special Characters: & ( ) ^ ; | , and
<space>
Here...
MS-DOS: Windows Command Environment
http://www.dx21.com/HOME/ARTICLES/P2P/ARTICLE.ASP?CID=1...

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:3btdhvF6jrer7U26@individual.net,
Stan Brown <the_stan_brown@fastmail.fm> hunted and pecked:
> In versions of the command prompt like Win98, the ^ (caret or
> circumflex, ASCII 94) is just an ordinary character. In the XP
> command prompt it's the escape that causes the following character
> to be ordinary. Example:
>
> echo P(A^|B) is the conditional probability of A given B
>
> My question is, with which version of Windows did ^ become special?
> And is there some environment variable I can test that was created
> or changed at the same time?
>
> I need to do something like this, in other words:
>
> set CARET=^^
> if "%...%" = "..." set CARET=^
>
> but I don't know how to test reliably for which versions of Windows
> do (or don't) make the caret special.
>
> --
>
> Stan Brown, Oak Road Systems, Tompkins County, New York, USA
> http://OakRoadSystems.com/
Anonymous
April 14, 2005 10:37:42 AM

Archived from groups: microsoft.public.windowsxp.customize (More info?)

"Wesley Vogel" wrote in microsoft.public.windowsxp.customize:
>Windows NT4.x . Maybe earlier.

Thanks...

--

Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
Related resources
!