Click here to Skip to main content
12,350,728 members (26,119 online)
   

C#

 
AnswerRe: Better code Pin
santhosh.3591@gmail.com14-Feb-13 8:19
membersanthosh.3591@gmail.com14-Feb-13 8:19 
GeneralRe: Better code Pin
Amir Mohammad Nasrollahi29-Jul-13 22:16
professionalAmir Mohammad Nasrollahi29-Jul-13 22:16 
AnswerRe: Better code Pin
Eddy Vluggen14-Feb-13 8:30
mvpEddy Vluggen14-Feb-13 8:30 
GeneralRe: Better code Pin
source.compiler14-Feb-13 12:05
membersource.compiler14-Feb-13 12:05 
GeneralRe: Better code Pin
Bull City Rambler14-Feb-13 12:58
memberBull City Rambler14-Feb-13 12:58 
GeneralRe: Better code Pin
Eddy Vluggen14-Feb-13 21:01
mvpEddy Vluggen14-Feb-13 21:01 
AnswerRe: Better code Pin
cjb11015-Feb-13 0:59
membercjb11015-Feb-13 0:59 
QuestionSend/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 3:13
memberadam.m.b.nelson14-Feb-13 3: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 Pin
Richard MacCutchan14-Feb-13 3:45
mvpRichard MacCutchan14-Feb-13 3:45 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 3:54
memberadam.m.b.nelson14-Feb-13 3:54 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 4:57
mvpRichard MacCutchan14-Feb-13 4:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 5:46
memberadam.m.b.nelson14-Feb-13 5:46 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 5:56
memberadam.m.b.nelson14-Feb-13 5:56 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 6:01
mvpRichard MacCutchan14-Feb-13 6:01 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 6:57
memberadam.m.b.nelson14-Feb-13 6:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 7:03
mvpRichard MacCutchan14-Feb-13 7:03 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 7:45
memberadam.m.b.nelson14-Feb-13 7:45 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 8:02
memberadam.m.b.nelson14-Feb-13 8:02 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 6:29
mvpRichard MacCutchan14-Feb-13 6:29 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 7:04
memberadam.m.b.nelson14-Feb-13 7:04 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 7:21
mvpRichard MacCutchan14-Feb-13 7:21 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 8:06
memberadam.m.b.nelson14-Feb-13 8:06 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 9:41
mvpRichard MacCutchan14-Feb-13 9:41 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 9:48
memberadam.m.b.nelson14-Feb-13 9:48 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 10:08
mvpRichard MacCutchan14-Feb-13 10:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web01 | 2.8.160621.1 | Last Updated 26 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid