C#直接打开计算器或记事本

private void gvButton1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
            System.Diagnostics.Process proc = new System.Diagnostics.Process();

            //设置外部程序名(记事本用 notepad.exe 计算器用 calc.exe)
            info.FileName = "calc.exe";

            //设置外部程序的启动参数

            info.Arguments = "";

            //设置外部程序工作目录为c:\windows

            info.WorkingDirectory = "c:/windows/";

            try
            {
                //
                //启动外部程序
                //
                proc = System.Diagnostics.Process.Start(info);
            }
            catch
            {
                MessageBox.Show("系统找不到指定的程序文件", "错误提示!");
                return;
            }

        }

posted @ 2007-09-21 11:33  谢杰  阅读(4060)  评论(0编辑  收藏  举报