Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate a simple Floppy Format

Status
Not open for further replies.

zackiv31

Programmer
May 25, 2006
148
US
Here's what I got, but I dont know how to sendkeys only when input is waiting for something:

Code:
Process proc = new Process();
                    proc.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System).ToString() + @"\format";
                    proc.StartInfo.Arguments = comboBoxF3.SelectedItem.ToString() + "/V:";

                    proc.Start();
                    SendKeys.SendWait("{ENTER}");
//HERE is where I need assistance..
                    SendKeys.SendWait("{n}");
                    SendKeys.SendWait("{ENTER}");

In the above I need to wait where it says "HERE" until the format has finished... it asks if I want to format another (y/n) and so I then want to send the "n" and "ENTER"
T
 
When you took the Process() approach - did you try sending System.Environment.NewLine ?

There's absoluetly no reason I can think of why doing it that way wouldn't work - it must be something silly.

My other question is : Floppy? What year is it?! :)

 
Ever tried to install XP on a RAID that wasn't supported by the install CD ;)


... currently trying your new suggestion of the newline.. I'll be back...
 
Well now I remember, the Process approach doesn't work.

if I redirect standardinput and set useshellexecute to false, whenever I try to start the process, I get an unhandled Win32 Exception.

If I leave them at the defaults, it doesn't allow me to send commands because redirection is set to false.


Back to not having a clue :-/ Even if someone doesn't have a floppy, the basic problem (i think) is that I can't write a string to a command line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top