如何运行这个批处理文件?

huangapple go评论52阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年2月6日 03:58:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75355112.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定