当进程在后台运行时暂停调试 [英] Pause debug when a process is running in background

查看:107
本文介绍了当进程在后台运行时暂停调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下:

My code is below :

Dim filePathArg As String = "C:\Documents and Settings\Administrator\Desktop\MSI Installer\Dependency Setup\SQL Setup\x86\setup\setupsql.exe Start /Wait -s -fl ""C:\Documents and Settings\Administrator\Desktop\MSI Installer\Dependency Setup\SQL Setup\x86\setup\setup.iss"""

Shell(filePathArg, AppWinStyle.Hide)



上面的代码可以完美运行,以静默方式安装在SQL Server 2000中(即命令提示符)
但是我想做的是,下一行将在完成后台进程后进行调试(即等待运行调试)

我该如何解决以上问题?
请帮助我..



Above code is perfectly running to install in SQL server 2000 in silent mode(i.e. command prompt)
But i want to do that other next line will debuging after complete background process (i.e. to wait running debug)

How will i solve the above problem??
Please help me..

推荐答案

问题非常不清楚.

也许您需要能够等待安装过程完成.为此,请使用System.System.Diagnostics.Process.Start方法而不是Shell.

请参阅 http://msdn.microsoft.com/en-us/library/system.diagnostics .process.aspx [ ^ ].

静态方法将返回Process的实例;并且在先前创建的Project实例上调用了非静态方法Process.Start(),您可以使用其构造函数创建该实例,并将Project.StartInfor属性分配给所需的开始信息.

请参见System.Diagnostics.ProcessStartInfo http://msdn.microsoft.com/en-us/library /system.diagnostics.processstartinfo.aspx [ ^ ].

在这两种情况下,您都有一个Process实例,可以在启动过程后查看项目的状态.您可以使用Process.ExitCode(处理异常,请参见此属性的帮助).当您知道该过程已成功启动时,可以使用方法WaitForExit等待该过程完成的时间.
与所有Wait方法一样,该方法正在阻塞!您最好在单独的线程中全部调用.

—SA
The question is very unclear.

Perhaps you need to be able to wait until installation process is complete. To do it, use System.System.Diagnostics.Process.Start methods instead of Shell.

See http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^].

Static methods will return the instance of Process; and the non-static method Process.Start() is called on a previously created instance of Project you can create with its constructor, with Project.StartInfor property assigned to the start info you want.

See System.Diagnostics.ProcessStartInfo, http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx[^].

In both cases, you have an instance of Process to see the status of the project after the process is started; you can use Process.ExitCode (handle exceptions, see the help on this property). When you know that the process has been successfully started, you can wait for the moment of time when it is complete using the method WaitForExit.

As all Wait methods, this method is blocking! You better to call it all in a separate thread.

—SA


这篇关于当进程在后台运行时暂停调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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