使用批处理文件对多个文件执行命令 [英] Execute a command over multiple files with a batch file

查看:168
本文介绍了使用批处理文件对多个文件执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.exe文件,它以两个jpg图像作为参数,并对它们进行一些处理。所以,cmd中的命令是:

  myfile.exe base_image.jpg image1.jpg 


  myfile.exe base_image.jpg image2.jpg 

myfile.exe base_image.jpg image3.jpg

...

myfile.exe base_image.jpg image50000.jpg

改写它我需要执行: myfile.exe base_image.jpg image%d.jpg for d [1,50000]



所有必需的文件都放在同一个文件夹中。是否有可能为这个工作写一个批处理文件?

解决方案

这是一个单一的命令,所以你不需要一个批处理文件

  for / l %% a in(1,1,50000)do myfile.exe base_image.jpg image %% a.jpg 


I have an .exe file which takes two jpg images as arguments and makes some processing on them. So, the command in cmd is:

myfile.exe base_image.jpg image1.jpg

The first image is standard, while the second one changes and I need this execution to be repeated over 50000 images. So in each iteration the command is modified as

myfile.exe base_image.jpg image2.jpg

myfile.exe base_image.jpg image3.jpg

...

myfile.exe base_image.jpg image50000.jpg

Rephrasing it I need to execute this: myfile.exe base_image.jpg image%d.jpg for d [1,50000]

All the necessary files are placed in the same folder. Is it possible to write a batch file for this job?

解决方案

That's a single command, so you don't really need a batch file

for /l %%a in (1,1,50000) do myfile.exe base_image.jpg image%%a.jpg

这篇关于使用批处理文件对多个文件执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆