Process pro = new Process();
pro.StartInfo.UserName = "aaa_iuser"; // 指定以特定使用者執行
string pw = "P@$$w0rd";
SecureString ss = new SecureString(); // password 要以SecureString傳入,而且一定要給password = =
foreach (char c in pw)
{
ss.AppendChar(c);
}
pro.StartInfo.Password = ss;
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.FileName = "notepad.exe";
pro.Start();