1Console.Write("Username: ");
2string user = Console.ReadLine();
3string[] userParts = user.Split('\\');
4
5Console.Write("Password: ");
6SecureString password = GetPassword();
7
8try
9{
10 ProcessStartInfo psi = new ProcessStartInfo(args[0]);
11 psi.UseShellExecute = false;
12
13 if(userParts.Length == 2)
14 {
15 psi.Domain = userParts[0];
16 psi.UserName = userParts[1];
17 }
18 else
19 {
20 psi.UserName = userParts[0];
21 }
22
23 psi.Password = password;
24
25 Process.Start(psi);
26}
27catch(Win32Exception e)
28{
29 Console.WriteLine("Error starting application");
30 Console.WriteLine(e.Message);
31}