Establish network connection

//開始網路連線
System.Diagnostics.ProcessStartInfo psInfo = new System.Diagnostics.ProcessStartInfo(@”C:\WINDOWS\system32\net.exe”);
psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psInfo.Arguments = @”net use \\192.168.0.15\RD$ ams.prog /user:programw”; //輸入相關資訊
System.Diagnostics.Process.Start(psInfo);

Anuncios

Running a program

System.Diagnostics.Process.Start(“mspaint.exe”);   //Only for program in System32

OR

ProcessStartInfo info = new ProcessStartInfo(@”C:\…exe”);

System.Diagnostics.Process.Start(info);

info.WorkingDirectory = @”C:\Windows\System32″;