Click here to Skip to main content
15,881,881 members
Home / Discussions / C#
   

C#

 
AnswerRe: Better code Pin
sonusonyy14-Feb-13 8:19
sonusonyy14-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
professionalEddy Vluggen14-Feb-13 8:30 
GeneralRe: Better code Pin
ali_heidari_14-Feb-13 12:05
ali_heidari_14-Feb-13 12:05 
GeneralRe: Better code Pin
Bull City Rambler14-Feb-13 12:58
Bull City Rambler14-Feb-13 12:58 
GeneralRe: Better code Pin
Eddy Vluggen14-Feb-13 21:01
professionalEddy Vluggen14-Feb-13 21:01 
AnswerRe: Better code Pin
cjb11015-Feb-13 0:59
cjb11015-Feb-13 0:59 
QuestionSend/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 3:13
adam.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
mveRichard MacCutchan14-Feb-13 3:45 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 3:54
adam.m.b.nelson14-Feb-13 3:54 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 4:57
mveRichard MacCutchan14-Feb-13 4:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 5:46
adam.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
adam.m.b.nelson14-Feb-13 5:56 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 6:01
mveRichard MacCutchan14-Feb-13 6:01 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 6:57
adam.m.b.nelson14-Feb-13 6:57 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 7:03
mveRichard MacCutchan14-Feb-13 7:03 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 7:45
adam.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
adam.m.b.nelson14-Feb-13 8:02 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 6:29
mveRichard MacCutchan14-Feb-13 6:29 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 7:04
adam.m.b.nelson14-Feb-13 7:04 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 7:21
mveRichard MacCutchan14-Feb-13 7:21 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 8:06
adam.m.b.nelson14-Feb-13 8:06 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 9:41
mveRichard MacCutchan14-Feb-13 9:41 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
adam.m.b.nelson14-Feb-13 9:48
adam.m.b.nelson14-Feb-13 9:48 
GeneralRe: Send/Receive text to CMD from C# GUI Pin
Richard MacCutchan14-Feb-13 10:08
mveRichard 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.