1.cmd 或 powersehll 執行 .exe文件,關閉 cmd 或 powershell 窗口后,運行的.exe進程會自動殺掉
- 解決方法:先創建一個.bat文件:如 test.bat 內容如下
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
(.exe 絕對路徑, 如)C:\Users\admin\start.exe
2. 運行
- cmd 模式,進入 test.bat 目錄,執行
test.bat
- powershell 模式,進入 test.bat 目錄,執行
./test.bat