如何在命令提示符下进行“ for”循环?

编程入门 行业动态 更新时间:2024-10-25 20:23:43
本文介绍了如何在命令提示符下进行“ for”循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用执行图像处理的命令行程序,并且需要在整个图像文件夹上运行相同的命令。我听说我可以在命令提示符下运行循环,但是我在网上看到了各种各样的示例,因此无法弄清楚语法。文件夹中的图像一直标记为 single0.pgm,single1.pgm,single2.pgm,...,一直到single39.pgm。我需要运行的命令是:

I'm working with a command-line program that does image-processing, and I need to run the same command on an entire folder of images. I have heard that I can run loops in the command prompt, but I have seen all sorts of different examples online and can't figure out the syntax. The images in the folder are labled "single0.pgm, single1.pgm, single2.pgm,..." all the way to single39.pgm. The command I need to run is:

DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i single0.pgm -o single0.ppm

我需要为每张照片做到这一点。在C语言中,这只是一个简单的 for 循环,例如

And I need to do that for every picture. In C it is just a simple for loop like

for (int j = 0; j<40; j++) { DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i singlej.pgm -o singlej.ppm }

如何在命令提示符下执行此操作?

How do I do that in the command prompt?

推荐答案

我知道了!对于任何好奇的人,循环是:

I figured it out! For anyone curious, the loop is:

for %a in (0 1 2 3 4 5 6 7 8 9 10 11 1 2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i single%a..pgm -o si ngle%a.ppm

更多推荐

如何在命令提示符下进行“ for”循环?

本文发布于:2023-11-06 17:22:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564315.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令提示符   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!