With this code snippet, you can launch and get the output of any DOS like applications.
This is C# style coding for launching applications:
Code:
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WorkingDirectory = "c:\\";
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/c net users";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
// Preparing to get stdout output.
string stdout = process.StandardOutput.ReadToEnd();
process.Close();
// Show the results.
MessageBox.Show(stdout);
and here is VB.NET style:
Code:
Dim process As New System.Diagnostics.Process()
process.StartInfo.WorkingDirectory = "c:\"
process.StartInfo.UseShellExecute = False
process.StartInfo.FileName = "cmd.exe"
process.StartInfo.Arguments = "/c net users"
process.StartInfo.CreateNoWindow = True
process.StartInfo.RedirectStandardInput = True
process.StartInfo.RedirectStandardOutput = True
process.StartInfo.RedirectStandardError = True
process.Start()
' Preparing to get stdout output.
Dim stdout As String = process.StandardOutput.ReadToEnd()
process.Close()
' Show the results.
MessageBox.Show(stdout)
but your problem is that you placed your application in wrong path.
C# Style Coding with your startup path:
Code:
Process.Start(Application.StartupPath + "\\AL_Login\\StartLoginServer.bat");
VB.NET Style Coding with your startup path:
Code:
Process.Start(Application.StartupPath & "\AL_Login\StartLoginServer.bat");