-1

I can get result with this bat file that I want. However I can't use this result!

@echo off
identify -format "%%wx%%h" E:\Image.jpg

Result:

640x480

I tried something like this ...etc, but they don't work:

set var=%%wx%%h
echo %var%

How should I do this, thank you so much....

Kenshin
  • 159
  • 1
  • 1
  • 9

1 Answers1

1

cmd's way to get the output of a command is a for /f loop. The following should work (untried):

for /f "delims=" %%a in ('identify -format "%%wx%%h" E:\Image.jpg') do set "var=%%a"
echo Result=%%a

See for /? for details about the loop format.

Note: this works best when the command outputs just one line.

Stephan
  • 53,940
  • 10
  • 58
  • 91