Reputation: 9
I am trying to pass arguments to the SysInteranls Autologon.exe file, and am unable to do so. This is the C# Code that I am using:
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);
It works if I set the startInfo.Arguments = "USER DOMAIN PASSWORD"; Any help would be greatly appreciated.
Todd
Upvotes: 1
Views: 1428
Reputation: 30111
As per your last statement, You need a space in between them.
startInfo.Arguments = usr + " " + domain + " " + pass;
To keep the code cleaner, use the string.Format
method.
startInfo.Arguments = string.Format("{0} {1} {2}", usr, domain, pass);
Upvotes: 5