我有一个批处理文件,需要传递包含管道符和空格的参数。由于有空格,因此在传递参数时需要附加双引号。我需要去掉这些双引号并显示参数。通常,使用~可以让我做到这一点,但我认为我传递的特定参数会导致问题。如果我这样做:
[test1.bat]
call test2.bat "Account|Access Level|Description"
[test2.bat]
echo %1
echo %~1
运行test1.bat后,我得到了以下输出:
"Account|Access Level|Description"
'Access' is not recognized as an internal or external command, operable program or batch file.
那么我该如何去掉双引号并且仍然有一个可用的变量?
.\blah.cmd "asdf"" 123"
这样引用调用批处理文件时,echo !str!
输出两个双引号而不是一个。 - binki