当前位置: 首页>>代码示例>>C#>>正文


C# ProcessStartInfo.Start方法代码示例

本文整理汇总了C#中System.Diagnostics.ProcessStartInfo.Start方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessStartInfo.Start方法的具体用法?C# ProcessStartInfo.Start怎么用?C# ProcessStartInfo.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Diagnostics.ProcessStartInfo的用法示例。


在下文中一共展示了ProcessStartInfo.Start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Exec

			/// <exception cref="NGit.Errors.TransportException"></exception>
			public virtual SystemProcess Exec(string command, int timeout)
			{
				string ssh = SystemReader.GetInstance().Getenv("GIT_SSH");
				bool putty = ssh.ToLower().Contains("plink");
				IList<string> args = new AList<string>();
				args.AddItem(ssh);
				if (putty && !ssh.ToLower().Contains("tortoiseplink"))
				{
					args.AddItem("-batch");
				}
				if (0 < this._enclosing.GetURI().GetPort())
				{
					args.AddItem(putty ? "-P" : "-p");
					args.AddItem(this._enclosing.GetURI().GetPort().ToString());
				}
				if (this._enclosing.GetURI().GetUser() != null)
				{
					args.AddItem(this._enclosing.GetURI().GetUser() + "@" + this._enclosing.GetURI().
						GetHost());
				}
				else
				{
					args.AddItem(this._enclosing.GetURI().GetHost());
				}
				args.AddItem(command);
				ProcessStartInfo pb = new ProcessStartInfo();
				pb.SetCommand(args);
				if (this._enclosing.local.Directory != null)
				{
					pb.EnvironmentVariables.Put(Constants.GIT_DIR_KEY, this._enclosing.local.Directory
						.GetPath());
				}
				try
				{
					return pb.Start();
				}
				catch (IOException err)
				{
					throw new TransportException(err.Message, err);
				}
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:42,代码来源:TransportGitSsh.cs

示例2: Ngen

        /// <summary>
        /// Runs ngen in the background to pre-compile new/updated .NET assemblies.
        /// </summary>
        private void Ngen()
        {
            if (IsPortable || !WindowsUtils.IsAdministrator) return;

            // Use .NET 4.0 if possible, otherwise 2.0
            string netFxDir = WindowsUtils.GetNetFxDirectory(
                WindowsUtils.HasNetFxVersion(WindowsUtils.NetFx40) ? WindowsUtils.NetFx40 : WindowsUtils.NetFx20);

            string ngenPath = Path.Combine(netFxDir, "ngen.exe");
            if (!File.Exists(ngenPath)) return;

            foreach (string assembly in _ngenAssemblies)
            {
                string arguments = new[] {"install", Path.Combine(Target, assembly)}.JoinEscapeArguments();
                var startInfo = new ProcessStartInfo(ngenPath, arguments) {WindowStyle = ProcessWindowStyle.Hidden};
                using (var process = startInfo.Start())
                    if (process != null) process.WaitForExit();
            }
        }
开发者ID:modulexcite,项目名称:0install-win,代码行数:22,代码来源:UpdateProcess.cs

示例3: Exec

			/// <exception cref="NGit.Errors.TransportException"></exception>
			internal override void Exec(string commandName)
			{
				string ssh = SystemReader.GetInstance().Getenv("GIT_SSH");
				bool putty = ssh.ToLower().Contains("plink");
				IList<string> args = new AList<string>();
				args.AddItem(ssh);
				if (putty)
				{
					args.AddItem("--batch");
				}
				if (0 < this._enclosing.GetURI().GetPort())
				{
					args.AddItem(putty ? "-P" : "-p");
					args.AddItem(this._enclosing.GetURI().GetPort().ToString());
				}
				if (this._enclosing.GetURI().GetUser() != null)
				{
					args.AddItem(this._enclosing.GetURI().GetUser() + "@" + this._enclosing.GetURI().
						GetHost());
				}
				else
				{
					args.AddItem(this._enclosing.GetURI().GetHost());
				}
				args.AddItem(this._enclosing.CommandFor(commandName));
				ProcessStartInfo pb = new ProcessStartInfo();
				pb.SetCommand(args);
				if (this._enclosing.local.Directory != null)
				{
					pb.EnvironmentVariables.Put(Constants.GIT_DIR_KEY, this._enclosing.local.Directory
						.GetPath());
				}
				try
				{
					this.proc = pb.Start();
				}
				catch (IOException err)
				{
					throw new TransportException(this._enclosing.uri, err.Message, err);
				}
			}
开发者ID:nickname100,项目名称:monodevelop,代码行数:42,代码来源:TransportGitSsh.cs

示例4: buttonCommandLine_Click

        private void buttonCommandLine_Click(object sender, EventArgs e)
        {
            ProcessUtils.SanitizeEnvironmentVariables();

            var cmd = new ProcessStartInfo("cmd.exe", "/k echo " + Resources.CommandLineHint)
            {
                UseShellExecute = false,
                WorkingDirectory = Locations.IsPortable ? Locations.PortableBase : Locations.HomeDir
            };
            cmd.EnvironmentVariables["Path"] = Locations.InstallBase + Path.PathSeparator + Environment.GetEnvironmentVariable("Path");
            cmd.Start();
        }
开发者ID:0install,项目名称:0install-win,代码行数:12,代码来源:MainForm.cs


注:本文中的System.Diagnostics.ProcessStartInfo.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。