标题: [文本处理] 批处理特殊字符赋值为什么会报语法错误? [打印本页]
作者: an410398183 时间: 2013-5-16 15:25 标题: 批处理特殊字符赋值为什么会报语法错误?
- @echo off
- set test=<value>hello world!</value>
- echo %test%
- pause
复制代码
为什么会报:语法错误呢?
"The syntax of the command is incorrect."
难道特殊字符的赋值还有什么要示吗
作者: Demon 时间: 2013-5-16 15:29
转义
作者: an410398183 时间: 2013-5-16 15:35
本帖最后由 an410398183 于 2013-5-16 15:39 编辑
回复 2# Demon - @echo off
- set test=^<value^>
- echo %test%
- pause
复制代码
这样还是有错- @echo off
- set test=\<test\>
- echo %test%
- pause
复制代码
这样还是有错,
为什么呢??
作者: wankoilz 时间: 2013-5-16 15:43
@echo off&setlocal enabledelayedexpansion
set test=^<test^>
echo !test!
pause
作者: an410398183 时间: 2013-5-16 15:45
回复 4# wankoilz
可以呀,这也涉及到变量延时?
谢谢了
偶还要多多学习
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |