简体   繁体   中英

How to continuously run a exe within a batch file with different parameters

I have an exe application that takes in 2 parameters. One is a input file path with an specific extension (eg *.jpg) and Second is the output file path.

Now in a folder, I have let's say 100 jpeg images which I want to pass in continuously and saved the output with the same file name as the input (extension will be different, the exe does the conversion).

Any idea how do I write a batch file to achieve this?

Thanks and Regards, Perumal

Try this:

@FOR %%1 IN (%1) DO convert %%1 %2\%%n1.png

To be used as:

bulkconvert c:\test\*.jpg c:\test

It'll call convert for each file that matches the search pattern c:\\test*.jpg and a 2nd parameter will be provided with the path provided as batch's 2nd parameter (note: there is not the trailing backslash) with the same file name but with extension png.

As reference: How to get folder path from file path with CMD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM