找到你要的答案

Q:Run shell command step by step

Q:分步运行shell命令

I am vb.net user. Please some one help me! How to run shell command in step by step. When runing shell command in projects,the projects run all command the same time. Cann't run step by step.

Thanks....,Sorry for Spelling.

I am vb.net user. Please some one help me! How to run shell command in step by step. When runing shell command in projects,the projects run all command the same time. Cann't run step by step.

谢谢,抱歉拼写。

answer1: 回答1:

If you're using Interaction class' Shell function, the 3rd parameter in it is boolean Wait. Set it to True - and each Shell statement will wait for completion of the command before invoking the next one.

As far as I remember, Shell doesn't wait for child subprocesses, so if you start a process which starts another one and then exits (e.g. bat file without call or with start) - you might face some issues. In this case consider changing the complete tree of calls. Another option would be to use System.Management assembly to trace cals tree using WMI as described here.

如果使用交互类的shell函数,它的第三个参数是布尔等待。将它设置为true,每个shell语句将在调用下一个命令之前等待命令的完成。

就我所记得的,外壳不等待孩子的子过程,所以如果你开始一个过程,开始另一个,然后退出(如BAT文件没有电话或启动)-你可能会面临一些问题。在这种情况下,考虑改变完整的调用树。另一个选择是使用系统管理组件跟踪CALS树使用WMI的描述在这里。

vb.net