4

我有一个用于转换图像的批处理文件,参数是引号,并且参数内的引号字符串被转义。但是,我想将当前路径 %CD %also 作为参数发送...但是执行以下操作:

"C:\Program Files\GIMP 2\bin\gimp-2.8.exe"  -i -b "(python-fu-watermark-folder RUN-INTERACTIVE \"%CD%\" \"%CD%_watermarked\" \"C:/Documents and Settings/Jan/Desktop/watermarking/customEffectsWatermark.png\")"  -b "(gimp-quit 0)"

给我一个回声:

C:\Documents and Settings\Jan\Desktop\watermarking\tester>"C:\Program Files\GIMP2\bin\gimp-2.8.exe"  -i -b "(python-fu-watermark-folder RUN-INTERACTIVE \"C:\Documents and Settings\Jan\Desktop\watermarking\tester\" \"C:\Documents and Settings\Jan\Desktop\watermarking\tester_watermarked\" \"C:/Documents and Settings/Jan/Desktop/watermarking/customEffectsWatermark.png\")"  -b "(gimp-quit 0)"

这很好,但是,目录中的反斜杠是转义字符!所以在执行插件时,我最终得到了一个转义目录(我不想要那个):

WatermarkFolder-Warning: C:Documents and SettingsJanDesktopwatermarking ester
WatermarkFolder-Warning: C:Documents and SettingsJanDesktopwatermarking ester_watermarked
WatermarkFolder-Warning: files to be processed in total: 0

由于我无法控制路径,有没有办法逃脱转义字符?谢谢!矿脉

4

1 回答 1

6

您是否尝试过使用 %CD% 双重转义值的变量?

像这样的东西:

set mycd=%cd:\=\\%

并在您使用 %cd% 的地方使用 %mycd%

于 2013-07-02T19:13:26.067 回答