英文:
How can I run this bat file?
问题
这段代码在命令提示符(cmd)上直接运行时工作正常:
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective '0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900' img_x.jpg
但是,如果将这段代码放入批处理文件(bat文件),它就无法正常工作。
@echo off
Setlocal EnableDelayedExpansion
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective '0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900' img_x.jpg
它会出现以下错误:
magick: invalid list of numbers '-distort'
如何解决这个问题?谢谢。
英文:
This code works properly if I put it directly on cmd:
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective '0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900' img_x.jpg
However, if I put this code in a bat file, it doesn't work.
@echo off
Setlocal EnableDelayedExpansion
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective '0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900' img_x.jpg
It gives this error:
magick: invalid list of numbers '-distort'
How can I do this. Thanks...
答案1
得分: 2
-distort
选项后的参数需要用引号括起来。
@echo off
Setlocal EnableDelayedExpansion
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective "0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900" img_x.jpg
英文:
The argument for the -distort
option needs to be enclosed in quotes.
@echo off
Setlocal EnableDelayedExpansion
magick img.jpg -alpha Set -virtual-pixel transparent -distort Perspective "0,0,0,0 0,1900,0,1900 900,0,900,200 900,900,900,900" img_x.jpg
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论