Vb.net 如何执行多个命令以在Process.Start()中打开应用程序,该程序使用命令行在单个进程中打开cmd.exe?

Vb.net 如何执行多个命令以在Process.Start()中打开应用程序,该程序使用命令行在单个进程中打开cmd.exe?,vb.net,command-line,cmd,process,Vb.net,Command Line,Cmd,Process,我无法在一次执行中将目录从C:\更改为C:\Apps\app.exe。Cmd不允许我这么做。我想先执行C:\Apps,然后执行app.exe参数,以便使用Process.Start()打开cmd.exe,在一次运行中打开。这是我的密码 Dim FullPath As String = "C:\Apps\app.exe" Dim appPath As String = "C:\Apps" Dim appName As String = "app.exe" Dim p As Process = Pr

我无法在一次执行中将目录从
C:\
更改为
C:\Apps\app.exe
。Cmd不允许我这么做。我想先执行
C:\Apps
,然后执行
app.exe
参数,以便使用
Process.Start()
打开
cmd.exe
,在一次运行中打开
。这是我的密码

Dim FullPath As String = "C:\Apps\app.exe"
Dim appPath As String = "C:\Apps"
Dim appName As String = "app.exe"
Dim p As Process = Process.Start("cmd.exe", "/k cd " + appPath)
'Don't know what to do here...
我的输出应该是这样的:

多亏了@Babbillumpa,我解决了我的问题:

Dim _processStartInfo As ProcessStartInfo = New ProcessStartInfo()
        _processStartInfo.WorkingDirectory = appPath
        _processStartInfo.FileName = "cmd.exe"
        _processStartInfo.Arguments = "/k app.exe"
        _processStartInfo.CreateNoWindow = True

        Dim myProcess As Process = Process.Start(_processStartInfo)
        'wait for specific time for the thread to be closed
        myProcess.WaitForExit(500)

        ' Close process by sending a close message to its main window.
        myProcess.CloseMainWindow()
        ' Free resources associated with process.
        myProcess.Close()

可能重复的非常有用的链接。它帮助我解决我的问题。:)