[英]Passing percent sign in a batch parameter CALL
On Windows 7.... 在Windows 7上....
This SO Answer seems to be in error for me: Use of Percent Sign as a CMD Parameter 这个SO答案似乎对我来说是错误的: 使用百分号作为CMD参数
In Called.bat 在Called.bat中
echo 1=%1
Caller Bat 来电棒
call called.bat "percent%%sign"
Results 结果
percent%%sign = percent 百分比%%符号=百分比
"percent%%sign" = "percent" “%%% sign”=“百分比”
percent^%sign = percent 百分比^%符号=百分比
"percent^%sign" = "percent^%sign" “%^%sign”=“%^%sign”
percent%%%%sign= percent %%%%%符号=百分比
percent%%%sign= percent 百分比%%%符号=百分比
"percent%%%%sign" = "percent" “%%%%%标志”=“百分比”
"percent%%%sign" = "percent" “%%%% sign”=“百分比”
caller 呼叫者
@ECHO OFF
SETLOCAL
CALL qq22658604 "percent%sign"
CALL qq22658604 "percent%%sign"
CALL qq22658604 "percent%%%sign"
CALL qq22658604 "percent%%%%sign"
CALL qq22658604 percent%sign
CALL qq22658604 percent%%sign
CALL qq22658604 percent%%%sign
CALL qq22658604 percent%%%%sign
GOTO :EOF
qq22658604 qq22658604
@ECHO OFF
ECHO 1=%1
GOTO :EOF
results 结果
1="percentsign"
1="percentsign"
1="percentsign"
1="percent%sign"
1=percentsign
1=percentsign
1=percentsign
1=percent%sign
NFF. NFF。
When I use a second.bat
with 当我使用
second.bat
时
@echo off
echo %~1
There are two cases now. 现在有两种情况。
If you call second.bat
from a batch file, the CALL
line in the caller batch needs to be 如果从批处理文件中调用
second.bat
,则CALL
者批处理中的CALL
行必须是
call called.bat "percent%%%%sign"
You could omit the quotes, as long as there are no spaces inside the parameter 只要参数内没有空格,就可以省略引号
If you call the called.bat
directly from the cmd-prompt you can use 如果直接从cmd-prompt调用
called.bat
,则可以使用
call called.bat "percent%sign"
Ok, this one is my bad. 好的,这个是我的坏。 The issue is caused by cmd shell software called "Take Command" v13 by JP Software.
该问题是由JP Software的名为“Take Command”v13的cmd shell软件引起的。 The echo command is behaving differently.
echo命令的行为不同。 I have no insight on how to get it working correctly at this time.
我目前还没有了解如何让它正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.