C#将参数传递给Sysinternals Autologon.exe

1 c# autologin

我试图将参数传递给SysInteranls Autologon.exe文件,但我无法这样做.这是我正在使用的C#代码:

string usr = usrTextBox.Text.ToString();
                string auto = autologon;
                string domain = STORES;
                string pass = password;
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow = false;
                startInfo.UseShellExecute = false;
                startInfo.FileName = "Autologon.exe";
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                startInfo.Arguments = usr + domain + pass;
                Process.Start(startInfo);
Run Code Online (Sandbox Code Playgroud)

如果我设置startInfo.Arguments ="USER DOMAIN PASSWORD",它可以工作; 任何帮助将不胜感激.

托德

The*_*ter 5

根据你上次的陈述,你需要在它们之间留一个空格.

startInfo.Arguments = usr + " " + domain + " " + pass;
Run Code Online (Sandbox Code Playgroud)

要使代码更清晰,请使用该string.Format方法.

startInfo.Arguments = string.Format("{0} {1} {2}", usr, domain, pass);
Run Code Online (Sandbox Code Playgroud)