我正在使用不同的用户凭据启动流程。我希望这个过程从隐藏开始。我正在使用fallowing code.But它不起作用。该过程从可见开始。
private void f(){
try {
System.Security.SecureString ssPwd = new System.Security.SecureString();
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "app.exe";
process.StartInfo.Arguments = "Params";
process.StartInfo.LoadUserProfile = true;
process.StartInfo.Domain = domain;
process.StartInfo.UserName = username;
for (int x = 0; x < password.Length; x++) {
ssPwd.AppendChar(password[x]);
}
process.StartInfo.Password = ssPwd;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit();
} catch (Exception ex) {
Console.WriteLine("Exception occurred. " + ex.Message);
}
}