Hiding command window in vb.net when running processes
Asked Answered
R

2

5

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!

Rambler answered 2/8, 2012 at 16:12 Comment(0)
W
6

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

Proc.StartInfo.CreateNoWindow = true
Warrantee answered 2/8, 2012 at 16:14 Comment(0)
C
3

CreateNoWindow = True did not work for me, Below work perfectly :

Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Corves answered 7/4, 2021 at 14:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.