5

如果我有这个代码

    ' 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()

我该怎么做才能使命令窗口在执行时不出现?谢谢!

4

2 回答 2

6

您可以通过将 CreateNoWindow 设置为 true 来实现,这可能有助于MSDN

Proc.StartInfo.CreateNoWindow = true
于 2012-08-02T16:14:17.463 回答
2

CreateNoWindow = True 对我不起作用,下面完美地工作:

Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
于 2021-04-07T14:56:21.113 回答