I'm creating an application in VB.Net which is using the command to complete the tasks the reason why I'm doing this on VB.Net is that I have an interface where the user will be able to type in and also choose the prefered options, the vapplication will then send the kesy to the command to perform it so now the problem is that the command shows I want to hide it, let say I have this System.Diagnostics.process.Start("command")
SendKeys.Send("path & "{enter}") now let say I want to hide the command but send keys to it any help? Sorry for not formating the codes I'm using a phone so it doesn't show the options of formating. Or let say I want to copy a file to another file using the command the paths of the file that will be copied will be typed on a textbox and on the other textbox you can type the directory file to copy the file to and when you click the button the command will be executed and be feeded with these instructions while it hiden. Thank you

3 Years
Discussion Span
Last Post by Mr.M

Thanks but i tried it and it produced lot os errors, I dont know how I can go about it. Or perhaps if you can guide me because the With function produce errors.


You declare the process at the class level because you don't want it to go out of scope. You use WithEvents because you want to be able to respond to thge events when the process sends text to StdOut and StdErr.

Private WithEvents MyProcess As Process

My example used delegates because the background process had to write text to the textbox controls. Since you aren't doing that you won't need the delegates. Just declare two strings at the class level and call them something like stdout and stderr. You first create an instance of the process object then set it to CMD.EXE. You want it to be hidden to you set CreateNoWindow to True. You redirect standard input, standard output and standard error because you will be managing those yourself.

MyProcess = New Process

With MyProcess.StartInfo
    .FileName = "CMD.EXE"
    .UseShellExecute = False
    .CreateNoWindow = True
    .RedirectStandardInput = True
    .RedirectStandardOutput = True
    .RedirectStandardError = True
End With


MyProcess.BeginErrorReadLine()      'start async read on stderr
MyProcess.BeginOutputReadLine()     'start async read on stdout

When you want to execute a command you do


Thank you will test that and will report back and if it solved my question I will then mark this thread as solved.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.