简体   繁体   中英

Set environment variable to > 'graterthan' windows 7 batch script

How to set Environment variable greater than symbol (>) in batch scripting in windows 7?

This is my script

set cmd=dir
set simb=>
set log=c:\Test\grater

%cmd% %simb% %log%

Output on cmd is:

C:\\Test>test.bat

C:\\Test>set cmd=dir The syntax of the command is incorrect.

C:\\Test>set simb=>

C:\\Test>

Thanks

用双引号转义>

set "simb=>"

Use a caret to escape the 'greater than' symbol:

set simb=^>

If you need to display the greater than symbol, you have to escape both a caret ^ and the > :

set simb=^^^>

or with double quotes:

set "simb=^>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM