第一次连接局域网计算机时,自动填写用户,密码进行登陆,以后就不需在连接了.
//
连接网络计算机
private void ConnectRemoteMachine( string folder, string userName, string password)
... {
Process process1 = new Process();
try
...{
process1.StartInfo.FileName = "net";
String arguments = " use " +folder +" "+ password + " "+"/User:"+userName;
process1.StartInfo.Arguments = arguments;
process1.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process1.Start();
process1.WaitForExit();
process1.Close();
}
catch(Exception ex)
...{
MessageBox.Show("connection fail..."+ex.Message);
}
}
private void ConnectRemoteMachine( string folder, string userName, string password)
... {
Process process1 = new Process();
try
...{
process1.StartInfo.FileName = "net";
String arguments = " use " +folder +" "+ password + " "+"/User:"+userName;
process1.StartInfo.Arguments = arguments;
process1.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process1.Start();
process1.WaitForExit();
process1.Close();
}
catch(Exception ex)
...{
MessageBox.Show("connection fail..."+ex.Message);
}
}