我有一个批处理文件,用于转换图像,参数是引号,参数中的引号字符串是转义的。但是,我想将当前路径%CD%也作为参数发送...但执行此操作:
"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
由于我无法控制路径,有没有办法逃脱escapecharacters? 谢谢! 矿脉
答案 0 :(得分:6)
您是否尝试使用%CD%double escapeped的值创建变量?
这样的事情:
set mycd=%cd:\=\\%
使用%mycd%,你使用的是%cd%