gongdehui

gongdehui

  • NA
  • 63
  • 0

problem about how to invoke os format command in C#

Nov 20 2004 8:28 AM
I want to invoke the format command of OS(XP) im my C# code: string VolumeName = "UDISK"; string FormatW2K = "CMD.EXE"; string FormatW2KParam = string.Format("/C \"format.com {0}:/q/x/V:{1}\"",driverletter,VolumeName); Win32.ShellExecute((IntPtr)0,"open", FormatW2K, FormatW2KParam, string.Empty, Win32.SW_SHOW); I have got two problems: 1,the format function always compels me to click the Enter key to go on the format operation.I want to my code can do it for me.So,my program will invoke the Format command and do format operation automatically and never bother me.Then how to realize my dream? 2,When the Format command has been invoked,my program automatically perform the following code no matter if the format operation finished or not.But I hope that the following code should be perform as long as the format operation finished.So,how to settle this problem? Thanks!

Answers (1)