【问题标题】:How to pass command line arguments to the .exe file (e.g silent mode) using process.start如何使用 process.start 将命令行参数传递给 .exe 文件(例如静默模式)
【发布时间】:2012-09-15 13:59:42
【问题描述】:

我在这个应用程序中有一个 vb.net windows 应用程序我想在静默模式下运行另一个 exe 文件,首先我在命令行中运行这个 exe 文件它正在工作。但我不知道如何通过这些参数通过 vb.coding process.start 。

通过命令行我已经通过了这样的。 D:\myapps>sample.exe /s /v/qn(工作正常)

但是通过编码我已经通过了这样的方式

 Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
        Dim info As New System.Diagnostics.ProcessStartInfo
        info.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\sample.exe"
        info.Arguments = "/s /v/qn"
        Dim process As New System.Diagnostics.Process
        process.StartInfo = info
        process.Start()
        MessageBox.Show(info.Arguments.ToString())
        process.Close()

这不起作用此代码有什么问题请帮助我..

【问题讨论】:

    标签: vb.net processstartinfo commandargument


    【解决方案1】:
    Process.Start("D:\myapps\sample.exe", "/s /v/qn")
    

    【讨论】:

    • 谢谢 sss.. 实际上我一开始就尝试过这个但它无法运行它。但是当我第二次运行时它工作正常..
    猜你喜欢
    • 2010-09-11
    • 1970-01-01
    • 2010-11-20
    • 1970-01-01
    • 2016-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-01
    相关资源
    最近更新 更多