close

C# 開啟執行檔
開啟執行檔
System.Diagnostics.Process.Start("notepad.exe"); // 記事本
System.Diagnostics.Process.Start("calc.exe"); // 小算盤


後面加參數
System.Diagnostics.Process.Start("自己寫的執行檔.exe","自己需要的參數");
再配合主程式

 static void Main(string[] 自己需要的參數)
{
            if (自己需要的參數[0] != "asldfie09484")
                return;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
}

//在開程式裡面可以直接設定
專案>內容>偵錯>命令列的引數,這裡就是可以讓你打入參數,如果你有多個參數,就用空白鍵分開 


開啟程式
Process update = new Process();
update.StartInfo.FileName = 根目錄 + 更新檔名 + ".exe";
update.Start();

關閉程式
notifyIcon.Dispose();
close = true;
this.Close();
App.Current.Shutdown();
Process main = Process.GetCurrentProcess();
main.Kill();

arrow
arrow
    全站熱搜

    createps 發表在 痞客邦 留言(0) 人氣()