标签:磁盘 family uid tftp throw put string line password
调用cmd.exe 连接磁盘
public string connectFTP(string vPath, string vUID, string vPassword) { string errormsg = ""; Process proc = new Process(); try { proc.StartInfo.FileName = "cmd.exe"; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.CreateNoWindow = true; proc.Start(); string dosLine = "net use " + vPath + " " + vPassword + " /user:" + vUID; proc.StandardInput.WriteLine(dosLine); proc.StandardInput.WriteLine("exit"); while (!proc.HasExited) { proc.WaitForExit(1000); } errormsg = proc.StandardError.ReadToEnd(); proc.StandardError.Close(); } catch (Exception ex) { //throw ex; //MessageBox.Show(ex.Message); } finally { proc.Close(); proc.Dispose(); } return errormsg; }
标签:磁盘 family uid tftp throw put string line password
原文地址:https://www.cnblogs.com/wml-it/p/14729518.html