# Globbing in Windows to process images - how do bash loops look in DOS?

I'm doing some batch image processing with imagemagick on OSX using this line:

for file in $(cat all.txt); do convert -crop 50X50@ +repage +adjoin "$file" "$file"_tile_50x50@_%d.jpeg; done  It takes a filelist as an input, chops each file into 50x50 pixel tiles, and labels the output with the original filename and an index number (%d). The quantity of imagery is about 400+ source images, and hence 1,000,000 output images. I have to move the processing to a Windows 10 box. Can someone help me translate the above loop across, or suggest a better way to achieve the same outcome? ## 1 Answer Oh well, answering my own question again; hoping someone else finds it useful! Using Windows Powershell, the below. Place the source images (jpeg image files in my example) in directory foo, the create the outputdir directory. Then execute this command: dir -recurse -include *.jpeg | %{convert$._FullName -crop 50x50@ +repage +adjoin “C:\foo\bar\outputdir\$($_.Name)”}


Loads of thanks to the contributors on this Stack Overflow question for giving the right structure and keywords for me to solve the problem.