一、打开HBuilder X根目录
网络异常,图片无法展示
|
依次找到main.js
HBuilderX \ plugins \ builtincef3terminal \ script \ main.js
二、编辑main.js
将17到40行代码的powershell.exe跟cmd.exe都改为绝对路径。
下面为示例:
if(isWin){ shell = 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'; var osRelease = os.release(); var dotIndex = osRelease.indexOf('.'); if(dotIndex>0){ var fv = osRelease.substring(0,dotIndex); if(fv>6){ shell = 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'; }else{ shell = 'C:/Windows/WinSxS/wow64_microsoft-windows-commandprompt_31bf3856ad364e35_10.0.16299.15_none_b84d9d01bfe1be94/cmd.exe'; var ov = osRelease.substring(dotIndex); dotIndex = ov.indexOf('.'); if(dotIndex>0){ var sv = ov.substring(0,dotIndex); if(sv>1){ shell = 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'; } } } } }else{ shell = 'bash'; } // 下面这行日志不能删除,用于判断是否为powershell console.log("powershell:"+(shell=='C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'));
保存,重启终端窗口。