gpt4 book ai didi

windows - 批处理文件: How to Double Quote a Command/C when the command itself needs Quotes

转载 作者:行者123 更新时间:2023-12-03 11:10:33 26 4
gpt4 key购买 nike

我正在制作一个Windows批处理文件以运行7zip命令行来压缩一组文件。需要根据文档引用以下脚本中/C后面的部分。问题出在文件路径周围已经有双引号引起了。我是否需要\转义某些引号,使用多余的引号,单引号?我尝试过的一切都没有奏效。

这是/c之后的命令部分:

/c "c:\program files\data\7-zip\7z" a "c:\program files\data\backups\test1.7z" "c:\program files\data\backups\test1.txt" -mmt1

整个脚本(如果需要):
forfiles /p "c:\program files\data\backups" /m *.txt /c "c:\program files\data\7-zip\7z" a "c:\program files\data\backups\test1.7z" "c:\program files\data\backups\test1.txt" -mmt1

最佳答案

我遇到了同样的问题,这是一个如何为我的案例解决的概念:

@FORFILES /s /m *.ext /c "cmd /c \"\"C:\Program Files\Blah\blah-blah-blah.exe\" -o1 --option2 /option3 @file\"" >%~n0.log 2>&1

相当棘手,但可以!

关于windows - 批处理文件: How to Double Quote a Command/C when the command itself needs Quotes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56130238/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com