Convert C# command prompt app to Windows App

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am fairly new to .NET, and I have an app that runs fom the command prompt
to perform some AD user utilities. I want to convert it to a Windows app to
make it easier for others in my department to use. Is there an easy way to
do this?
 
Robocox... This should get you started. Just create a Windows Form
project and slap on two textboxes and a button :).

using System;
using System.Diagnostics;
using System.IO;

namespace TestProcess
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo("IPCONFIG.exe" );
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcessStartInfo.Arguments= "/all";
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();

StreamReader myStreamReader = myProcess.StandardOutput;
string output = myProcess.StandardOutput.ReadToEnd();
myProcess.WaitForExit();

Console.WriteLine(output);
myProcess.Close();
Console.ReadLine();
}
}
}


Regards,
Jeff
I am fairly new to .NET, and I have an app that runs fom the command
prompt to perform some AD user utilities. I want to convert it to a
Windows app to make it easier for others in my department to use. Is
there an easy way to do this?<
 
Oh... If you expect to redirect cin _and_ cout, you will need to use two
separate threads to avoid a lock.

Regards,
Jeff
 
Back
Top