??????????У???????C??????????????subst??????????X?????C#???????????????X????C???е????·??????????C#?в?????????????????????????????????????????????DOS????????subst????????????б?????????????????????????????C#???DOS????????????????????н??????????

???????????????????????????????????κε?DOS????????????????????
<span style="white-space:pre"> </span>public string Execute(string dosCommand?? int milliseconds)
{
string output = "";     //????????
if (dosCommand != null && dosCommand != "")
{
Process process = new Process();     //???????????
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "cmd.exe";      //?趨?????е?????
startInfo.Arguments = "/C " + dosCommand;   //?趨?????????е?“/C”????????????????????
startInfo.UseShellExecute = false;     //????????????????
startInfo.RedirectStandardInput = false;   //???????????
startInfo.RedirectStandardOutput = true;   //????????
startInfo.CreateNoWindow = true;     //??????????
process.StartInfo = startInfo;
try
{
if (process.Start())       //???????
{
if (milliseconds == 0)
process.WaitForExit();     //?????????????????
else
process.WaitForExit(milliseconds);  //????????????????????н????Σ?????????????DOS????
output = process.StandardOutput.ReadToEnd();//???????????
}
}
catch
{
}
finally
{
if (process != null)
process.Close();
}
}
return output;
}
<span style="white-space:pre">  </span>string result = Execute("subst"?? 1000);
 
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????