Search code examples
batch-filecmdpaint

mspaint problems creating bat


I need to make a .bat in Windows that does the following: Open a huge amount of .jpg files with paint and then resave them. They can be overwritten or saved into a new folder, that doesn't matter.

My code is the following:

mkdir newFolder 
FOR %%x in (*.jpg) DO mspaint %%x > newFolder/new%%x

The problem is that the file saved is not a copy of the original one. I can't just copy all the files because they HAVE to pass trough paint, but cant figure out where the problem is.

When I open that new file it just shows a black image with the text "new0001.jpg".


Solution

  • Mspaint is not designed for batch usage. It has no command line option to save a file. You could look at a windows scripting solution (where your script essentially clicks on menu items in mspaint to save the file and close), or look at different graphics packages such as those suggested here: MS Paint command line switches