vb.net 如何使用 process.start 将命令行参数传递给 .exe 文件(例如静默模式)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12559446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to pass command line arguments to the .exe file (e.g silent mode) using process.start
提问by Victor Athoti.
I have an vb.net windows application in this application i want run another exe file in silent mode,for this first i have run this exe file in command line it is working.But i don't know how to pass the these arguments through vb.coding process.start .
我在这个应用程序中有一个 vb.net windows 应用程序我想在静默模式下运行另一个 exe 文件,为此我首先在命令行中运行了这个 exe 文件它正在工作。但我不知道如何传递这些参数vb.coding process.start 。
through command line i have pass like this. D:\myapps>sample.exe /s /v/qn(working fine)
通过命令行我已经通过了这样的。 D:\myapps>sample.exe /s /v/qn(工作正常)
but through coding i have pass like this
但是通过编码我已经通过了这样的
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()
this is not working what is wrong with this code please help me..
这不起作用此代码有什么问题请帮助我..
回答by SSS
Process.Start("D:\myapps\sample.exe", "/s /v/qn")