windows commands用Process.Start()方法開啟

windows commands用Process.Start()方法開啟

將一些windows commands用Process.Start()方法開啟

       #region windows command 執行
        /// <summary>
        /// Calls the calucater 開啟小算盤 .
        /// </summary>
        public static void CallCalucater()
        {
            System.Diagnostics.Process.Start("calc.exe");    // 開啟小算盤 
        }
        /// <summary>
        /// Calls the notepad 開啟記事本.
        /// </summary>
        public static void CallNotepad()
        {
            System.Diagnostics.Process.Start("notepad.exe"); // 開啟記事本
        }

        /// <summary>
        /// Calls the regedit 註冊表.
        /// </summary>
        public static void CallRegedit()
        {
            System.Diagnostics.Process.Start("regedit");//註冊表
        }
        /// <summary>
        /// Calls the gpedit 群組原則.
        /// </summary>
        public static void CallGpeditmsc()
        {
            System.Diagnostics.Process.Start("gpedit.msc");//群組原則
        }
        /// <summary>
        /// Calls the nslookup IP位址偵測.
        /// </summary>
        public static void CallNslookup()
        {
            System.Diagnostics.Process.Start("nslookup");//IP位址偵測
        }
        /// <summary>
        /// Calls the explorer 檔案總管.
        /// </summary>
        /// <param name="Address">The address.</param>
        public static void CallExplorer(string Address)
        {
            if (Address != string.Empty)
                System.Diagnostics.Process.Start("explorer", Address);//檔案總管
            else
                System.Diagnostics.Process.Start("explorer");
        }
        /// <summary>
        /// Calls the lusrmgrmsc 本機用戶及群組.
        /// </summary>
        public static void CallLusrmgrmsc()
        {
            System.Diagnostics.Process.Start("lusrmgr.msc");//本機用戶及群組
        }
        /// <summary>
        /// Calls the servicesmsc 本機服務.
        /// </summary>
        public static void CallServicesmsc()
        {
            System.Diagnostics.Process.Start("services.msc");//本機服務
        }
        /// <summary>
        /// Calls the compmgmtmsc 電腦管理.
        /// </summary>
        public static void CallCompmgmtmsc()
        {
            System.Diagnostics.Process.Start("compmgmt.msc");//電腦管理
        }
        /// <summary>
        /// Calls the devmgmtmsc 裝置管理員.
        /// </summary>
        public static void CallDevmgmtmsc()
        {
            System.Diagnostics.Process.Start("devmgmt.msc");//裝置管理員
        }
        /// <summary>
        /// Calls the winver Windows版本.
        /// </summary>
        public static void CallWinver()
        {
            System.Diagnostics.Process.Start("winver");//Windows版本
        }
        /// <summary>
        /// Calls the taskmgr 工作管理員.
        /// </summary>
        public static void CallTaskmgr()
        {
            System.Diagnostics.Process.Start("taskmgr");//工作管理員
        }
        /// <summary>
        /// Calls the eventvwrmsc 事件檢視器.
        /// </summary>
        public static void CallEventvwrmsc()
        {
            System.Diagnostics.Process.Start("eventvwr.msc");//事件檢視器
        }
        /// <summary>
        /// Calls the secpolmsc 本機安全性設定.
        /// </summary>
        public static void CallSecpolmsc()
        {
            System.Diagnostics.Process.Start("secpol.msc");//本機安全性設定
        }
        /// <summary>
        /// Calls the MSTSC 遠端桌面.
        /// </summary>
        public static void CallMstsc()
        {
            System.Diagnostics.Process.Start("mstsc");//遠端桌面
        }
        /// <summary>
        /// Calls the write word pad.
        /// </summary>
        public static void CallWrite()
        {
            System.Diagnostics.Process.Start("write");//word pad
        }
        /// <summary>
        /// Calls the MMC 主控台.
        /// </summary>
        public static void CallMmc()
        {
            System.Diagnostics.Process.Start("mmc");//主控台
        }
        /// <summary>
        /// Calls the dcomcnfg 系統元件服務.
        /// </summary>
        public static void CallDcomcnfg()
        {
            System.Diagnostics.Process.Start("dcomcnfg");//系統元件服務
        }
        /// <summary>
        /// Calls the osk 開啟螢幕小鍵盤.
        /// </summary>
        public static void CallOsk()
        {
            System.Diagnostics.Process.Start("osk");//開啟螢幕小鍵盤
        }
        /// <summary>
        /// Calls the control 控制台.
        /// </summary>
        public static void CallControl()
        {
            System.Diagnostics.Process.Start("control");//控制台
        }
        /// <summary>
        /// Calls the charmap 字元對應表.
        /// </summary>
        public static void CallCharmap()
        {
            System.Diagnostics.Process.Start("charmap");//字元對應表
        }        
        /// <summary>
        /// Calls the odbcad32 ODBC資料來源管理器.
        /// </summary>
        public static void CallOdbcad32()
        {
            System.Diagnostics.Process.Start("odbcad32");//ODBC資料來源管理器
        }
        /// <summary>
        /// Calls the ipconfig.
        /// </summary>
        /// <returns></returns>
        public static string CallIpconfig()
        {
            System.Diagnostics.ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = "ipconfig.exe";
            psi.Arguments = " /all";
            psi.UseShellExecute = false;
            psi.RedirectStandardInput = true;
            psi.RedirectStandardOutput = true;            
            System.Diagnostics.Process ps = new Process();
            ps.StartInfo = psi;
            ps.Start();
            StreamReader sr = ps.StandardOutput;            
            ps.Dispose();
            return sr.ReadToEnd();
        }
        #endregion