System.Diagnostics.Process.Start C# (CSharp) Method

Start() private method

private Start ( string fileName, string userName, SecureString password, string domain ) : Process
fileName string
userName string
password System.Security.SecureString
domain string
return Process
        public static Process Start(string fileName, string userName, SecureString password, string domain)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(fileName);            
            startInfo.UserName = userName;
            startInfo.Password = password;
            startInfo.Domain = domain;
            startInfo.UseShellExecute = false;
            return Start(startInfo);
        }

Same methods

Process::Start ( string fileName, string arguments, string userName, SecureString password, string domain ) : Process
Process::Start ( System startInfo ) : System.Diagnostics.Process
Process::Start ( string fileName ) : System.Diagnostics.Process
Process::Start ( string fileName, string arguments ) : System.Diagnostics.Process
Process::Start ( string fileName, string userName, System password, string domain ) : System.Diagnostics.Process
Process::Start ( string fileName, string arguments, string userName, System password, string domain ) : System.Diagnostics.Process
Process::Start ( ) : bool

Usage Example

Esempio n. 1
12
        public String cmd(String cnd)
        {

            cnd = cnd.Trim();
            String output = " ";
            Console.WriteLine(cnd);

            if ((cnd.Substring(0, 3).ToLower() == "cd_") && (cnd.Length > 2))
            {

                if (System.IO.Directory.Exists(cnd.Substring(2).Trim()))
                    cpath = cnd.Substring(2).Trim();

            }
            else
            {
                cnd = cnd.Insert(0, "/B /c ");
                Process p = new Process();
                p.StartInfo.WorkingDirectory = cpath;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.FileName = "cmd.exe";
                p.StartInfo.Arguments = cnd;
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.Start();
                output = p.StandardOutput.ReadToEnd();  // output of cmd
                output = (output.Length == 0) ? " " : output;
                p.WaitForExit();

            }
            return output;
        } // end cmd 
All Usage Examples Of System.Diagnostics.Process::Start