非阻塞批处理文件执行 [英] Non-blocking batch file execution

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

问题描述

我在批处理文件中具有以下命令:

I have the following commands in a batch file:

"C:\MI2\Stream\bin\Debug\Stream.exe" 19
"C:\MI2\Stream\bin\Debug\Stream.exe" 20
"C:\MI2\Stream\bin\Debug\Stream.exe" 21
"C:\MI2\Stream\bin\Debug\Stream.exe" 23
"C:\MI2\Stream\bin\Debug\Stream.exe" 25

我正在尝试执行我创建的应用程序的5个实例,并为每个实例传递不同的参数.我的目标是,当我运行此批处理文件时,它将启动该应用程序的5个实例,并为每个实例加载一个UI组件.最终,我将使它变得更加优雅,并在其周围放置一个包装器应用程序,但现在我只希望它们同时运行.

I'm attempting to execute 5 instances of an application I created, passing in a different param to each. My goal is that when I run this batch file, it launches the 5 instances of this app, loading a UI component for each. Eventually I will make this more elegant, and put a wrapper app around this, but for now i just want these to run simultaneously.

问题是,当我启动此批处理文件时,它将执行第一行并加载UI.而已.它不会继续前进到第二行.有想法吗?

The problem is, when I launch this batch file, it executes the first line, loading the UI. That's it. It doesn't move on to the second line. Thoughts?

编辑以添加-我当然可以在单独的批处理文件中执行此操作,但是我希望一键启动. 斯科特

Edit to Add - I could certainly do this from separate batch files, but I'd like to have one-click launching. Scott

推荐答案

您可以使用

You can use start:

start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 19
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 20
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 21
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 23
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 25

第一个参数是创建的命令行窗口的标题,我们不在乎,因此可以将其保留为空.

The first argument is the title of the created command line window, which we don't care about, so it can be left empty.

更好的方法是使用for:

forr %i in (19, 20, 21, 23, 25) do start "" "C:\MI2\Stream\bin\Debug\Stream.exe" %i

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

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