Click here to Skip to main content
       

C#

 
AnswerRe: Better code PinmemberAlan Balkany14-Feb-13 6:50 
GeneralRe: Better code PinmvpDave Kreskowiak14-Feb-13 7:09 
GeneralRe: Better code PinmvpEspen Harlinn14-Feb-13 7:14 
GeneralRe: Better code PinmemberAlan Balkany14-Feb-13 7:40 
GeneralRe: Better code Pinmembersource.compiler14-Feb-13 13:02 
GeneralRe: Better code PinmemberAlan Balkany15-Feb-13 4:18 
AnswerRe: Better code Pinmembersanthosh.3591@gmail.com14-Feb-13 9:19 
GeneralRe: Better code PinprofessionalAmir Mohammad Nasrollahi29-Jul-13 23:16 
AnswerRe: Better code PinmvpEddy Vluggen14-Feb-13 9:30 
GeneralRe: Better code Pinmembersource.compiler14-Feb-13 13:05 
GeneralRe: Better code PinmemberBull City Rambler14-Feb-13 13:58 
GeneralRe: Better code PinmvpEddy Vluggen14-Feb-13 22:01 
AnswerRe: Better code Pinmembercjb11015-Feb-13 1:59 
QuestionSend/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 4:13 
Hey there! I'm trying to write into a command prompt window (Not the debugger) from my C# GUI with no luck (I've looked at lots of examples), and I'm not sure where I am going wrong. The command prompt window will open, it will accept text if i type it in from my keyboard, but it won't accept it from my application.
 
I've tried with both the windows command prompt, and the custom one we are trying to write into. Long story short I am trying to access an AtmelAVR programmer from command line to automatically program devices in our assembly process. I can automatically program by command line when I enter the text myself, I just can't get out GUI to do it... I've attached my code below:
 
EDIT: Working in VS2010 on Windows 7
 
Any help is greatly appreciated!
 
<pre lang="c#"> 
Process PrgCommandPrmpt = new Process();
PrgCommandPrmpt.StartInfo.UseShellExecute = false;
PrgCommandPrmpt.StartInfo.FileName = "C:/Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Application/StudioCommandPrompt.exe";
            
PrgCommandPrmpt.StartInfo.RedirectStandardInput = true;
PrgCommandPrmpt.StartInfo.RedirectStandardOutput = true;
PrgCommandPrmpt.StartInfo.RedirectStandardError = true;
PrgCommandPrmpt.StartInfo.CreateNoWindow = true;
            
PrgCommandPrmpt.EnableRaisingEvents = false;
PrgCommandPrmpt.Start();
            
PrgCommandPrmpt.StandardInput.AutoFlush = true;
 
StreamWriter inputWriter = PrgCommandPrmpt.StandardInput;
StreamReader outputReader = PrgCommandPrmpt.StandardOutput;
StreamReader errorReader = PrgCommandPrmpt.StandardError;
            
            
myDelay5s();
tboxVerbose.AppendText("Doing stuff now!"); //This just outputs to a textbox to let me know something is happening.
string CommandText = "cd..";
            
inputWriter.WriteLine("WHY DONT YOU WORK");  //These are the two latest ways I tried to write to it, no luck.
PrgCommandPrmpt.StandardInput.Write(CommandText);//These are the two latest ways I tried to write to it, no luck.
inputWriter.Close();

AnswerRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 4:45 
GeneralRe: Send/Receive text to CMD from C# GUI [modified] Pinmemberadam.m.b.nelson14-Feb-13 4:54 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 5:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 6:46 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 6:56 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 7:01 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 7:57 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 8:03 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 8:45 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 9:02 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 7:29 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 8:04 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 8:21 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 9:06 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 10:41 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 10:48 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 11:08 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 11:27 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 23:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson15-Feb-13 3:21 
GeneralRe: Send/Receive text to CMD from C# GUI PinmvpRichard MacCutchan14-Feb-13 7:35 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 7:54 
AnswerRe: Send/Receive text to CMD from C# GUI PinmemberAlan N14-Feb-13 8:32 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 8:48 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson14-Feb-13 9:23 
GeneralRe: Send/Receive text to CMD from C# GUI [modified] PinmemberAlan N14-Feb-13 10:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberjschell14-Feb-13 12:44 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberadam.m.b.nelson15-Feb-13 3:22 
GeneralRe: Send/Receive text to CMD from C# GUI Pinmemberjschell15-Feb-13 9:57 
Questionobject recognition Pinmembermanoj dhunelg14-Feb-13 3:42 
AnswerRe: object recognition PinmvpRichard MacCutchan14-Feb-13 4:41 
AnswerRe: object recognition PinmvpDave Kreskowiak14-Feb-13 7:14 
Questionforcing users to use English language Pinmembersina rafati nia13-Feb-13 22:23 
AnswerRe: forcing users to use English language PinmemberManfred R. Bihy13-Feb-13 23:29 
AnswerRe: forcing users to use English language PinmemberN a v a n e e t h13-Feb-13 23:30 
GeneralRe: forcing users to use English language Pinmemberharold aptroot14-Feb-13 0:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 28 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid