PC Review


Reply
Thread Tools Rate Thread

Convert C# command prompt app to Windows App

 
 
=?Utf-8?B?Um9ib2NveA==?=
Guest
Posts: n/a
 
      12th Jan 2005
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?
 
Reply With Quote
 
 
 
 
Jeff Louie
Guest
Posts: n/a
 
      12th Jan 2005
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?<


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Jeff Louie
Guest
Posts: n/a
 
      12th Jan 2005
Oh... If you expect to redirect cin _and_ cout, you will need to use two
separate threads to avoid a lock.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command prompt "COPY" command not working in brand new Windows Vis CMD COPY command not working in Vista Windows Vista File Management 7 5th Feb 2008 09:20 PM
Command Prompt or Windows TBoon Microsoft VB .NET 3 16th Oct 2006 06:18 PM
VS command prompt vs Windows one? Ronald S. Cook Microsoft C# .NET 2 13th Oct 2006 03:44 AM
Command prompt convert fat 32 to NTFS =?Utf-8?B?UkM=?= Windows XP Performance 3 10th Sep 2004 10:05 PM
Windows 2k Registry Key from Command Prompt Keith Wisner Microsoft Windows 2000 Registry Archive 3 8th Jan 2004 07:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 AM.