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