In my application i set up a vpn connection via a command prompt window, the output will be put in a textbox. It refreshes itself so it will add a new line when it get one from the command prompt.
The output will be like this.
> Microsoft Windows [versie 6.1.7601] Copyright (c) 2009 Microsoft
> Corporation. Alle rechten voorbehouden.
>
> C:\Users\...\Desktop>rasdial.exe VPN username password
> Verbinding maken met VPN...
> Gebruikersnaam en wachtwoord controleren...
> Uw computer wordt in het netwerk geregistreerd...
> Verbinding gemaakt met VPN Opdracht voltooid.
>
> C:\Users\Helpdesk\Desktop>exit
how can i remove the Microsoft Windows part, so i only have this.
rasdial.exe VPN username password
Verbinding maken met VPN...
Gebruikersnaam en wachtwoord controleren...
Uw computer wordt in het netwerk geregistreerd...
Verbinding gemaakt met VPN Opdracht voltooid.
This is my code for the seperate line adding.
private void ConnectVPN()
{
CheckForIllegalCrossThreadCalls = false;
Process CMDprocess = new Process();
System.Diagnostics.ProcessStartInfo StartInfo = new System.Diagnostics.ProcessStartInfo();
StartInfo.FileName = "cmd";
StartInfo.CreateNoWindow = true;
StartInfo.RedirectStandardInput = true;
StartInfo.RedirectStandardOutput = true;
StartInfo.UseShellExecute = false;
CMDprocess.StartInfo = StartInfo;
CMDprocess.Start();
System.IO.StreamReader SR = CMDprocess.StandardOutput;
System.IO.StreamWriter SW = CMDprocess.StandardInput;
SW.WriteLine("rasdial.exe " + comboBox1.Text + " " + loginText.Text + " " + wachtwoordText.Text);
SW.WriteLine("exit");
string line = null;
do
{
line = SR.ReadLine();
if ((line != null))
{
VerbindingOutput.Text = VerbindingOutput.Text + line + Environment.NewLine;
}
} while (!(line == null));
}
Start the rasdial process directly and then pass it command line arguments using the Arguments property: