예제 #1
0
        /// <summary>
        /// Runs an external program using the specified command line arguments.
        /// </summary>
        /// <param name="environment">The script execution environment.</param>
        /// <param name="programFilePath">The program file path.</param>
        /// <param name="arguments">The arguments.</param>
        /// <param name="timeout">The timeout.</param>
        public static void Execute(
            IScriptExecutionEnvironment environment,
            string programFilePath,
            string arguments,
            TimeSpan timeout)
        {
            RunProgramTask task = new RunProgramTask(programFilePath, arguments, timeout)
            {
                FailOnError = true
            };

            task.Execute(environment);
        }
예제 #2
0
        /// <summary>
        /// Runs an external program using the specified command line arguments and running
        /// under a specified user account.
        /// </summary>
        /// <param name="environment">The script execution environment.</param>
        /// <param name="programFilePath">The program file path.</param>
        /// <param name="arguments">Command line arguments.</param>
        /// <param name="timeout">The program execution timeout.</param>
        /// <param name="userName">UserName under which the external program should be executed.</param>
        /// <param name="userDomain">User's domain.</param>
        /// <param name="password">User's password.</param>
        public static void Execute(
            IScriptExecutionEnvironment environment,
            string programFilePath,
            string arguments,
            TimeSpan timeout,
            string userName,
            string userDomain,
            string password)
        {
            RunProgramTask task = new RunProgramTask(
                programFilePath,
                arguments,
                timeout,
                userName,
                userDomain,
                password)
            {
                FailOnError = true,
            };

            task.Execute(environment);
        }