批处理文件由于某种原因在参数之间添加空格
我有一个奇怪的情况,由于某种原因,我的批处理文件中的语句被赋予了额外的空间。
scan "%1" -d "db" --memory -r -i --max-filesize=100m > output.txt
执行时,而不是执行:
scan "C:\" -d "db" --memory -r -i --max-filesize=100m
它执行:
scan "C:\" -d "db" --memory -r -i --max-filesize=100m
如您所见,它在“scan”和“C:\”之间添加了一个空格
有人能解释为什么会发生这种情况吗?
I have an odd situation where for some reason a statement in my batch file is given an additional space.
scan "%1" -d "db" --memory -r -i --max-filesize=100m > output.txt
When executed, instead of executing:
scan "C:\" -d "db" --memory -r -i --max-filesize=100m
it executes:
scan "C:\" -d "db" --memory -r -i --max-filesize=100m
As you can see it adds a space in-between "scan" and "C:\"
Could anyone explain why this is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是您引用了
C:\
。它不需要引号(因为它不包含空格),并且看起来应用程序正在将生成的\"
解释为转义引号,从而产生未终止的双引号字符串。欢迎来到批处理脚本的乐趣。
The problem is that you're quoting
C:\
. It doesn't need quoting (since it doesn't contain spaces) and it looks like the application is interpreting the resulting\"
as an escaped quote, resulting in an unterminated double-quoted string.Welcome to the joy of batch scripting.