Hiding command window in vb.net when running processes

◇◆丶佛笑我妖孽 提交于 2020-01-04 01:21:04

问题


If I have this code

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

What can I do to make the command window NOT appear when this is executed? Thanks!


回答1:


You can do it by setting CreateNoWindow to true, This may help MSDN

Proc.StartInfo.CreateNoWindow = true


来源:https://stackoverflow.com/questions/11781600/hiding-command-window-in-vb-net-when-running-processes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!