通過 IDE (inteliJ) 運行 Shell 腳本并收到:Linux 的 Windows 子系統沒有安裝發行版,有什么想法嗎?我的代碼:public class TestScript { public static void main(String args[]) throws IOException, InterruptedException { String[] cmd = { "bash", "-c", "ExecutorTest.sh" }; Process p = Runtime.getRuntime().exec(cmd); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((line = br.readLine()) != null) { System.out.println(line); } p.waitFor(); }}輸出:Windows Subsystem for Linux has no installed distributions.Distributions can be installed by visiting the Microsoft Store:https://aka.ms/wslstore
1 回答

慕妹3146593
TA貢獻1820條經驗 獲得超9個贊
為了能夠在 Windows 機器上運行 bash 和 bash 腳本,需要安裝適用于 Linux 的 Windows 子系統。您可能想嘗試安裝它?;蛘?,如果將 bash 腳本轉換為 Windows 批處理腳本,則可以通過啟動cmd
.
添加回答
舉報
0/150
提交
取消