Hi
Would you please assist me to turn this shell script (kindly written by fmw42) into a batch file:
cd
cd desktop/test1
imgname="rose"
arr=(`ls ${imgname}*.png`)
numimg=${#arr[*]}
num=`echo "scale=0; $numimg/2" | bc`
for ((i=0; i<num; i++)); do
j=$((2*i+1))
k=$((j+1))
convert ${imgname}$j.png ${imgname}$k.png +append ../test2/${imgname}${j}_${k}.png
done
cd
My intent is to drag and drop a number of images (or a folder containing images? this still confuses me)
into the batch file, so that images are joined two by two (side by side).
Note: i will be absent for a couple of days, so please do not be offended if I do not reply promptly...
Translate a Shell script into Windows Batch file
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Translate a Shell script into Windows Batch file
I would rather write a Fortran creating the series of DOS commands, but try the newsgroup alt.msdos.batch
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Translate a Shell script into Windows Batch file
I put myself to the problem: create the batch assoctab.bat with
for /L %%a in (1, 1, %1) do (
(set /a ileft="2*%%a-1")
(set /a iright="2*%%a")
call convert rose%%ileft%%.png rose%%iright%%.png +append tulip%%ileft%%_%%iright%%.png)
Type assoctab <number of initial png files>
Hope you will be able to adapt it.
for /L %%a in (1, 1, %1) do (
(set /a ileft="2*%%a-1")
(set /a iright="2*%%a")
call convert rose%%ileft%%.png rose%%iright%%.png +append tulip%%ileft%%_%%iright%%.png)
Type assoctab <number of initial png files>
Hope you will be able to adapt it.
Re: Translate a Shell script into Windows Batch file
For files:
for folders:
i append litle archive for you with ready and tested batch-s and one file its kind of demo that can realy help you
andestend how win cmd work. just drag on batch named files and folders and see.
if you need adapt batch-s to specific needs (i mean administrator staff not IM) i try to help you.
here worked solution and demo files: http://rgho.st/7F2wXHVwl
Code: Select all
@echo off
chcp 65001
cd /d "%~dp0"
md Append2
magick %*% +append ^
"./Append2/result%random%.png"
exit
Code: Select all
@echo off
chcp 65001
cd /d "%~dp0"
md Append2
magick %*%/*.png ^
+append ^
"./Append2/result%random%.png"
exit
andestend how win cmd work. just drag on batch named files and folders and see.
if you need adapt batch-s to specific needs (i mean administrator staff not IM) i try to help you.
here worked solution and demo files: http://rgho.st/7F2wXHVwl