我有一个批处理文件用于转换图像,参数是带引号的字符串,而且在参数中包含引号的字符串已经被转义。不过,我想把当前路径 %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
由于我无法控制路径,有没有一种方法可以避免转义字符的影响呢? 谢谢! Lode