문제

A start of the line

identify -format %w input.jpg

in Command Prompt leads to printing of the width of the image.

I have to assign this value to some variable within a CMD-file in order to use this variable further in the script. How can I do this?

I need some code like this:

@echo OFF  
set width=identify -format %w input.jpg
rem ...further usage of %width%...

However, it doesn't work.

P.S.: The code presented in this answer is almost what I need, but I need a code for the CMD-script.

도움이 되었습니까?

해결책

you might try this:

for /f %%a in ('identify -format %%w input.jpg') do set "width=%%~a"
echo %width%
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top