# SET command in Command Line



## lancastert (Apr 5, 2007)

I want to store *>>* into a SET variable.

Normally, I would do this:


```
SET VARIABLE=>>
```
However this returns an error.

How can I store *>>* without using quotation marks?

It needs to be *>>* in order for my script to work correctly?

Hope you guys can help.

Thanks.


----------



## Squashman (Apr 4, 2003)

How about posting the script!


----------



## lotuseclat79 (Sep 12, 2003)

Hi lancastert,

Welcome to TSG!

The set command is unique to the Shell being used. What OS are you running? And what Shell? Note: A Shell is the Command Line Processor for the OS in question. For example, Unix or Linux has several Shells: sh, csh, zsh. Windows has its own Shell.

-- Tom


----------



## Squashman (Apr 4, 2003)

the carrot is the escape character. Not sure why you want to do this.
set sometext=^>^>


----------



## lancastert (Apr 5, 2007)

I am on Windows.

That command:

```
set sometext=^>^>
```
 didn't work unfortunately.

What I want to do is store >> into a variable so I can ECHO it.

E.g.


```
SET SomeText=>>
ECHO %SomeText%
```
I would hope that the ECHO would return >> but it wouldn't because I cannot set >> in the first instance.

Hope this makes sense?


----------



## Squashman (Apr 4, 2003)

Works perfectly on my machine. What version of windows are you using.


----------



## Squashman (Apr 4, 2003)

It does set it, it just won't echo it. Just do the set command and then type set to see all your variables are set. Do that at the cmd line.

If you just want to echo >> 
just do that then.

echo ^>^>


----------



## Squashman (Apr 4, 2003)

Or this:

```
SETLOCAL EnableDelayedExpansion

set _MyVariable="^>^>"
CALL :dequote _MyVariable
echo %_MyVariable%

goto :eof

:DeQuote

SET _DeQuoteVar=%1
CALL SET _DeQuoteString=%%!_DeQuoteVar!%%
IF [!_DeQuoteString:~0^,1!]==[^"] (
IF [!_DeQuoteString:~-1!]==[^"] (SET _DeQuoteString=!_DeQuoteString:~1,-1!
) ELSE (GOTO :EOF)
) ELSE (GOTO :EOF)
SET !_DeQuoteVar!=!_DeQuoteString!
SET _DeQuoteVar=
SET _DeQuoteString=
GOTO :EOF
```
Courtesy of http://www.ss64.com/ntsyntax/dequote.html


----------



## Squashman (Apr 4, 2003)

This seems to work as well.

```
C:\Documents and Settings\Squashman>set sometext=^^^>^^^>

C:\Documents and Settings\Squashman>echo %sometext%
>>

C:\Documents and Settings\Squashman>
```
You can set the the variable to equal >> but when you echo it, it thinks you are redirecting. So you need to echo the escape character as well. So when setting the variable, you need to escape the escape and escape the redirect. If that makes any sense to you. Otherwise the script above works as well.


----------

