• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Diagnostics.Process类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



System.Diagnostics.Process类属于命名空间,在下文中一共展示了System.Diagnostics.Process类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: run_shell_script

 private static void run_shell_script()
 {
     System.Diagnostics.Process proc = new System.Diagnostics.Process();
     proc.EnableRaisingEvents = false;
     proc.StartInfo.FileName = "run.sh";
     proc.Start();
 }
开发者ID:SebastianLasisz,项目名称:Processing-video,代码行数:7,代码来源:MainWindow.cs


示例2: Help_Click

 private void Help_Click(object sender, RoutedEventArgs e)
 {
     var help = new System.Diagnostics.Process();
     help.StartInfo.FileName = @"Archiver Revolution.chm";
     help.StartInfo.UseShellExecute = true;
     help.Start();
 }
开发者ID:JKord,项目名称:ArchiverRevolution,代码行数:7,代码来源:MainWindow.xaml.cs


示例3: SpeakAsync

        public void SpeakAsync(string text)
        {
            if (MONO)
            {
                //if (_speechlinux == null)
                {
                    _state = SynthesizerState.Speaking;
                    _speechlinux = new System.Diagnostics.Process();
                    _speechlinux.StartInfo.RedirectStandardInput = true;
                    _speechlinux.StartInfo.UseShellExecute = false;
                    _speechlinux.StartInfo.FileName = "festival";
                    _speechlinux.Start();
                    _speechlinux.Exited += new EventHandler(_speechlinux_Exited);

                    log.Info("TTS: start " + _speechlinux.StartTime);

                }

                _state = SynthesizerState.Speaking;
                _speechlinux.StandardInput.WriteLine("(SayText \"" + text + "\")");
                _speechlinux.StandardInput.WriteLine("(quit)");

                _speechlinux.Close();

                _state = SynthesizerState.Ready;
            }
            else
            {
                _speechwindows.SpeakAsync(text);
            }

            log.Info("TTS: say " + text);
        }
开发者ID:kaldpils,项目名称:ardupilotone,代码行数:33,代码来源:Speech.cs


示例4: Reboot

                public static void Reboot()
                {
                        if (Lfx.Workspace.Master != null) {
                                Lfx.Workspace.Master.Disposing = true;
                                Lfx.Workspace.Master.Dispose();
                        }

                        string[] ParametrosAPasar = System.Environment.GetCommandLineArgs();
                        ParametrosAPasar[0] = "";
                        string Params = string.Join(" ", ParametrosAPasar).Trim();

                        string ExeName;
                        if (System.IO.File.Exists(Lfx.Environment.Folders.ApplicationFolder + "ActualizadorLazaro.exe"))
                                ExeName = Lfx.Environment.Folders.ApplicationFolder + "ActualizadorLazaro.exe";
                        else
                                ExeName = Lfx.Environment.Folders.ApplicationFolder + "Lazaro.exe";

                        System.Diagnostics.Process NuevoProceso = new System.Diagnostics.Process();
                        if (Lfx.Environment.SystemInformation.RunTime == Lfx.Environment.SystemInformation.RunTimes.DotNet) {
                                NuevoProceso.StartInfo = new System.Diagnostics.ProcessStartInfo(ExeName, Params);
                        } else {
                                string MonoName = Lfx.Environment.SystemInformation.Platform == SystemInformation.Platforms.Windows ? "mono.exe" : "/usr/bin/mono";
                                NuevoProceso.StartInfo = new System.Diagnostics.ProcessStartInfo(MonoName, @"""" + ExeName + @""" " + Params);
                        }

                        NuevoProceso.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
                        NuevoProceso.StartInfo.UseShellExecute = false;
                        NuevoProceso.Start();

                        System.Environment.Exit(0);
                }
开发者ID:solutema,项目名称:ultralight,代码行数:31,代码来源:Shell.cs


示例5: Chmod

 public static void Chmod(string Filename, int Chmod)
 {
     string exec = "chmod "+ Chmod.ToString() +" \""+ Filename +"\"";
     System.Diagnostics.Process process = new System.Diagnostics.Process();
     process.StartInfo.FileName = exec;
     process.Start();
 }
开发者ID:sundowndk,项目名称:SNDK,代码行数:7,代码来源:IO.cs


示例6: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();

            if(!UpdateSpec())
            {
                MessageBox.Show("error");
                return;
            }

            string path = Environment.CurrentDirectory.ToString() + "\\nuget.exe";

            if (!System.IO.File.Exists(directory + "\\nuget.exe"))
                System.IO.File.Copy(path, directory + "\\nuget.exe");

            System.Diagnostics.Process nuget = new System.Diagnostics.Process();
            nuget.StartInfo.FileName = directory + "\\nuget.exe";
            nuget.StartInfo.RedirectStandardOutput = true;
            nuget.StartInfo.UseShellExecute = false;
            nuget.StartInfo.WorkingDirectory = directory;
            nuget.StartInfo.Arguments = "pack ";//+ System.IO.Path.GetFileName(txtCsproj.Text);
            nuget.Start();

            var aa = nuget.StandardOutput.ReadToEnd();
            listBox1.Items.Add(nuget.StandardOutput.ReadToEnd());
        }
开发者ID:AlirezaP,项目名称:NugetUI,代码行数:26,代码来源:Form1.cs


示例7: CheckEpub

        //CheckEpubを実施、Output/Errorを表示する
        public void CheckEpub()
        {
            //EPUBチェック実施中パネルを表示する
            var checkingDlg = new EpubCheckingDialog();
            checkingDlg.Show();

            var p = new System.Diagnostics.Process();

            //実行ファイル
            p.StartInfo.FileName = javaPath;

            //引数
            var args = "-jar "
                        + "\""+ epubCheckPath + "\" "
                        +" \"" + epubPath + "\"";
            p.StartInfo.Arguments = args;

            //出力とエラーをストリームに書き込むようにする
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;

            //OutputDataReceivedとErrorDataReceivedイベントハンドラを追加
            p.OutputDataReceived += OutputDataReceived;
            p.ErrorDataReceived += ErrorDataReceived;

            p.StartInfo.RedirectStandardInput = false;
            p.StartInfo.CreateNoWindow = true;

            p.Start();

            p.BeginOutputReadLine();
            p.BeginErrorReadLine();

            p.WaitForExit();
            p.Close();

            var resultDlg = new EpubCheckResultDialog();

            //Outputをコピーする
            foreach (var output in outputLines)
            {
                resultDlg.outputTextBox.Text += (output + "\n");
            }

            //Errorをコピーする
            if (errorLines.Count> 1)
            {
                foreach (var error in errorLines)
                {
                    resultDlg.errorTextBox.Text += (error + "\n");
                }
            }
            else
            {
                resultDlg.errorTextBox.Text = "エラーはありませんでした。";
            }
            checkingDlg.Close();
            resultDlg.ShowDialog();
        }
开发者ID:sauberwind,项目名称:Nov2Epub,代码行数:61,代码来源:EpubCheckWrapper.cs


示例8: runningBalkCopy

        public static void runningBalkCopy(string dbName, string path, BCPDirection direction, string option, string remoteDb)
        {
            //ディレクション
            string strDirection = "in";
            if (direction == BCPDirection.BCP_OUT)
            {
                strDirection = "out";
            }
            else
            {
                strDirection = "in";
            }

            //リモートDB
            string strRemoteDb = "";
            if (remoteDb != "")
            {
                strRemoteDb = " -S " + remoteDb;
            }

            using (System.Diagnostics.Process proc = new System.Diagnostics.Process())
            {
                proc.StartInfo.FileName = "bcp";
                proc.StartInfo.Arguments = dbName + " " + strDirection + " \"" + path + "\" " + option + strRemoteDb;
                proc.Start();
                proc.WaitForExit();
            }
        }
开发者ID:yuta1011tokyo,项目名称:Liplis-Windows,代码行数:28,代码来源:LpsSqlServerBalkCopy.cs


示例9: Uninstall

        public override void Uninstall(IDictionary state)
        {
            //UninstallFirewallRule(state);
            /*
            bool rebootRequired;
            Interop.DriverPackageUninstallW(
                Context.Parameters["TARGETDIR"] + @"\ytdrv.inf",
                0,
                IntPtr.Zero,
                out rebootRequired
                );
            */
            // Удаляем драйвер.
            System.Diagnostics.Process infSetup =
                new System.Diagnostics.Process();

            infSetup.StartInfo.FileName = "rundll32";
            infSetup.StartInfo.Arguments =
                "advpack.dll, LaunchINFSection .\\ytdrv.inf,Uninstall.NT";
            infSetup.StartInfo.CreateNoWindow = true;
            infSetup.StartInfo.UseShellExecute = true;
            infSetup.StartInfo.WorkingDirectory = Context.Parameters["INSTDIR"];

            infSetup.Start();

            base.Uninstall(state);
        }
开发者ID:virl,项目名称:yttrium,代码行数:27,代码来源:ProjectInstaller.cs


示例10: Install

        public override void Install(IDictionary state)
        {
            // Устанавливаем драйвер.
            System.Diagnostics.Process infSetup =
                new System.Diagnostics.Process();

            infSetup.StartInfo.FileName = "rundll32";
            infSetup.StartInfo.Arguments = "syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\\ytdrv.inf";
            infSetup.StartInfo.CreateNoWindow = true;
            infSetup.StartInfo.UseShellExecute = false;
            infSetup.StartInfo.WorkingDirectory = Context.Parameters["INSTDIR"];

            infSetup.Start();

            base.Install(state);
            /*
            bool rebootRequired;
            int result = Interop.DriverPackageInstallW(
                Context.Parameters["INSTDIR"] + "ytdrv.inf",
                Interop.DRIVER_PACKAGE_LEGACY_MODE,
                IntPtr.Zero,
                out rebootRequired
                );

            MessageBox.Show(result.ToString("X"));
            //InstallFirewallRule(state);
             */
        }
开发者ID:virl,项目名称:yttrium,代码行数:28,代码来源:ProjectInstaller.cs


示例11: stackpanel_MouseDown

 private void stackpanel_MouseDown(object sender, MouseButtonEventArgs e)
 {
     string filename = (string)((StackPanel)(sender)).ToolTip;
     System.Diagnostics.Process process = new System.Diagnostics.Process();
     process.StartInfo = new System.Diagnostics.ProcessStartInfo(filename);
     process.Start();
 }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:7,代码来源:ImageViewer.xaml.cs


示例12: run

 void run()
 {
     System.Diagnostics.Process proc = new System.Diagnostics.Process();
     string strCmdLine="dir";
     //strCmdLine = "/C regenresx " + textBox1.Text + " " + textBox2.Text;
     System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
 }
开发者ID:ravihuang,项目名称:desktopassistant,代码行数:7,代码来源:RunShellScript.cs


示例13: Launch

		public static void Launch(Account account, String url) {

			if (account == null || account.Browser == null) {

				var action = new Action(() => System.Diagnostics.Process.Start(url));

				if (Program.MainForm.InvokeRequired) {
					Program.MainForm.Invoke(action);
				}
				else {
					action();
				}

				return;
			}

			Boolean poop = false;
			System.Diagnostics.Process browser = new System.Diagnostics.Process();

			browser.StartInfo.Arguments = url;
			browser.StartInfo.FileName = account.Browser.Path;

			try {
				browser.Start();
			}
			catch (InvalidOperationException) { poop = true; }
			catch (System.ComponentModel.Win32Exception) { poop = true; }

			if (poop) {
				System.Windows.Forms.Help.ShowHelp(Program.MainForm, url);
			}
		}
开发者ID:pamtbaau,项目名称:Gmail-Notifier-Plus,代码行数:32,代码来源:UrlHelper.cs


示例14: device_OnPaketArrival

        static void device_OnPaketArrival(object sender, CaptureEventArgs e)
        {
            Packet packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);
              var tcpPacket = TcpPacket.GetEncapsulated(packet);
            //  TcpPacket tcpPacket = packet.Extract(typeof(TcpPacket)) as TcpPacket;
              //string KeyWord = "qwe";
              if (tcpPacket != null) {
                  String SPort = tcpPacket.SourcePort.ToString();
                  var DPort = tcpPacket.DestinationPort.ToString();
                  var Data = Encoding.Unicode.GetString(tcpPacket.PayloadData); //Encoding.ASCII.GetString(tcpPacket.PayloadData).ToString();

                  if (OptionTCP.UnsafeCompareByte(tcpPacket.PayloadData, KeyWord))
                  {  //if  if (OptionTCP.UnsafeCompareByte(tcpPacket.PayloadData, KeyWord) && SPort = tcpPacket.SourcePort.ToString() == 1768)
                    Console.WriteLine("eeeeeeeess");
                    try
                    {
                        System.Diagnostics.Process proc = new System.Diagnostics.Process();
                        proc.StartInfo.FileName = "dropTcpPacket.exe";
                        proc.StartInfo.Arguments = StegWord;
                        proc.Start();
                    }
                    catch (Exception exp) {
                        Console.WriteLine("errro .. {0}", exp.ToString());
                    }
                  }
                  else Console.WriteLine("nnnnnnnnoo: {0}", Encoding.Unicode.GetString(KeyWord));

                  Console.WriteLine("Sport: {0},  DPort: {1}, Data: {2}", SPort, DPort, Data);
                  Console.WriteLine("==========================================================");

              }
        }
开发者ID:omusakhulu,项目名称:RSTEG,代码行数:32,代码来源:Program.cs


示例15: ExecuteCommand

        private static string ExecuteCommand(string fileName, string arguments)
        {
            try
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();

                process.StartInfo = new System.Diagnostics.ProcessStartInfo()
                {
                    FileName = fileName,
                    Arguments = arguments,
                    WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    UseShellExecute = false,
                    RedirectStandardError = true
                };

                process.Start();

                string error = process.StandardError.ReadToEnd();
                process.WaitForExit();

                return error;
            }
            catch (Exception e)
            {
                return e.Message;
            }
        }
开发者ID:TheX,项目名称:WinLess,代码行数:28,代码来源:Compiler.cs


示例16: Command

        public void Command(String Action, String Data)
        {
            iHandle = Win32.FindWindow("WMPlayerApp", "Windows Media Player");

            switch (Action)
            {
                case "Play":
                    {
                        if (iHandle == 0)
                        {
                            string FileName = @"wmplayer.exe";
                            System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
                            myProcess.StartInfo.FileName = FileName;
                            myProcess.Start();
                        }

                        Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004978, 0x00000000);
                        break;
                    }
                case "Stop":
                    {
                        if (iHandle == 0)
                            return;
                        Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004979, 0x00000000);
                        break;
                    }

            }
        }
开发者ID:amitcm,项目名称:RemoteMediaControl,代码行数:29,代码来源:MediaService.cs


示例17: Execute

 //function to run an exe with a given set of arguments 
 public static bool Execute(string executable, string[] args)
 {
   
   System.Diagnostics.Process proc = new System.Diagnostics.Process();
   proc.StartInfo.WorkingDirectory = ".";
   proc.StartInfo.UseShellExecute = false;
   proc.StartInfo.FileName = executable;
   //convert string[] to string for the process
   string arg = "";
   if((args != null) && args.Length >= 1)
   arg =  args[0];    
   for (int i = 1; i < args.Length; i++)
     arg = arg + " " + args[i];
   proc.StartInfo.Arguments = arg;
   bool ret = false;
   try
   {
    ret   = proc.Start();
   }
   catch (Exception ex)
   {
     Console.WriteLine(ex.Message);
     throw ex;
   }
   return ret;
 }
开发者ID:Logeshkumar,项目名称:Projects,代码行数:27,代码来源:Executor.cs


示例18: ElginTrackerForm

        public ElginTrackerForm()
        {
            InitializeComponent();
            openLogs = new Dictionary<RunLog, RunLogExplorerForm>();

            System.Diagnostics.Process proc;
            proc = new System.Diagnostics.Process();

            foreach (DataGridViewColumn col in dataGridView1.Columns)
            {
                columnVisibility.Items.Add(new DataGridColumnWrapper(col));
                columnVisibility.SetItemChecked(columnVisibility.Items.Count - 1, col.Visible);
            }

            variableColumns = new List<DataGridViewColumn>();
            variableColumns.Add(VarA);
            variableColumns.Add(VarB);
            variableColumns.Add(VarC);
            variableColumns.Add(VarD);
            variableColumns.Add(VarE);
            variableColumns.Add(VarF);
            variableColumns.Add(VarG);

            variableSelections = new Dictionary<DataGridViewColumn, ColumnVariableSelection>();
        }
开发者ID:edjoesu,项目名称:clinamen,代码行数:25,代码来源:ElginTrackerForm.cs


示例19: GetDevice

        public static string GetDevice(string path)
        {
            string result = "";
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = path + "\\adb.exe";
            //要执行的程序名称
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            //可能接受来自调用程序的输入信息
            p.StartInfo.RedirectStandardOutput = true;
            //由调用程序获取输出信息
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.Arguments = "devices";
            //不显示程序窗口
            p.Start();

            result += p.StandardOutput.ReadToEnd();
            //p.BeginOutputReadLine();
            p.WaitForExit();
            while (p.ExitCode != 0)
            {
                result += p.StandardOutput.ReadToEnd();
                Thread.Sleep(200);
            }
            p.Close();
            return result;
        }
开发者ID:cedarwy,项目名称:AppuimTestTools,代码行数:27,代码来源:Utils.cs


示例20: SaveScreenShot

        public static void SaveScreenShot(string path, string filename,string savepath)
        {
            //string result = "";
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = path + "\\adb.exe";
            //要执行的程序名称
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            //可能接受来自调用程序的输入信息
            p.StartInfo.RedirectStandardOutput = true;
            //由调用程序获取输出信息
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.Arguments = "pull /sdcard/"+filename+" " + savepath + "\\" + filename;
            //不显示程序窗口
            p.Start();

            //result += p.StandardOutput.ReadToEnd();
            //p.BeginOutputReadLine();
            p.WaitForExit();
            while (p.ExitCode != 0)
            {
                //result += p.StandardOutput.ReadToEnd();
                //Thread.Sleep(200);
            }
            Thread.Sleep(500);
            p.Close();
            return;
        }
开发者ID:cedarwy,项目名称:AppuimTestTools,代码行数:28,代码来源:Utils.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Diagnostics.ProcessStartInfo类代码示例发布时间:2022-05-24
下一篇:
C# System.Diagnostics类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap