当使用^符号输入带引号的多行命令时,如果使用双引号来使用带空格的字符串,还会传递^符号,任何人都可以解释这是什么吗?带双引号的批处理文件多行命令
working.cmd
@echo off
call openfiles.cmd^
C:\dir\filename.txt^
C:\another_dir\another_file.txt
notworking.cmd
@echo off
call openfiles.cmd^
"C:\dir with spaces\file with spaces.txt"^
"C:\another dir with spaces\another file with spaces.txt"
openfiles.cmd貌似
@echo off
for %%x in (%*) do (
IF EXIST %%x (
call "c:\Program Files\Notepad++\notepad++.exe" %%x
) ELSE (
call echo Not found %%x
)
)
pause
我的错误看起来像
C:\>call openfiles.cmd "C:\dir with spaces\file with spaces.txt"^
ELSE was unexpected at this time.
思在例如尝试在上面,我在前面的多余空格的双引号原来并没有它似乎修复我的问题 – Mazaka
它失败了,因为报价逃脱了,因此空间可以拆分文件mes到更小的部分 – jeb
“dubble”是我最喜欢的单词。 –