2012-08-02 93 views
2

的時候如果我有這樣的代碼隱藏命令窗口在vb.net中運行的進程

' Send file to Unix server via pscp 
    Dim Proc As New System.Diagnostics.Process 
    Proc.StartInfo = New ProcessStartInfo("C:\Windows\System32\cmd.exe") 
    Proc.StartInfo.Arguments = "/C C:\pscp.exe -pw " & PASSWORD & " " & physicalFolder & "\" & UNIXSCRIPTNAME & " " & unixLogin 
    Proc.StartInfo.RedirectStandardInput = True 
    Proc.StartInfo.RedirectStandardOutput = False 
    Proc.StartInfo.UseShellExecute = False 
    Proc.Start() 
    ' Allows script to execute sequentially instead of simultaneously 
    Proc.WaitForExit() 

我能做些什麼使命令窗口未出現此執行時? 謝謝!

回答

3

你可以通過設置CreateNoWindow到真正的做到這一點,這可能有助於MSDN

Proc.StartInfo.CreateNoWindow = true 
+0

這就是我需要的到底是什麼。謝謝! – envinyater 2012-08-02 16:16:27

+2

不客氣。 – Adil 2012-08-02 16:17:35