0%

C# 程式碼中開啟其他程式

C# with Open Something

要打開一些玩意兒
比如說要用 nodepad 打開
就可以用以下語法

1
Process.Start("notepad.exe", fileName);

也可以用 CMD 開

1
var proc = Process.Start(@"cmd.exe ",@"/c C:\Users\user2\Desktop\XXXX.reg")

最後我使用

1
2
3
4
5
6
7
8
9
10
11
var process = new Process
{
StartInfo = new ProcessStartInfo
{
WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
FileName = "python.exe",
Arguments = $"openWindow.py {loginInfo.CompanyId} {loginInfo.EmpId} {DecryptString(loginInfo.Pwd, _encryptKey)}"
}
};
process.Start();