标题: %符号的问题
[打印本页]
作者: bagpipe
时间: 2006-8-21 15:50
标题: %符号的问题
实例如下:
@echo off & set VAL=10& set Z=VAL
echo %Z%
echo %%Z%%
echo %%%Z%%%
echo %%%%Z%%%%
echo %%%%%Z%%%%%
call echo %Z%
call echo %%Z%%
call echo %%%Z%%%
call echo %%%%Z%%%%
call echo %%%%%Z%%%%%
gives the following output (only the line 'call echo %%%Z%%%' gives me what
I originally wanted): -
VAL
%Z%
%VAL%
%%Z%%
%%VAL%%
VAL
VAL
10
%Z%
%VAL%
And running the echo commands from test.bat at the command prompt gives: -
VAL
%VAL%
%%VAL%%
%%%VAL%%%
%%%%VAL%%%%
VAL
10
%10%
%%10%%
%%%10%%%
现在想问的问题是:在用CALL调用内部命令ECHO的时候要脱掉一个%符号,但是echo命令在显示%符号的时候是双%%显示为单%,4个%显示为双%,想问一下两者先考虑哪个?也就是说是先执行call的脱掉%字符?还是先脱掉echo显示%符号的脱掉,从以上实例可以看出先是脱掉ECHO进行显示的%符号脱掉,呵呵,大家细细琢磨吧,很绕人的,^_^.........
[
Last edited by bagpipe on 2006-8-21 at 15:51 ]