我试图运行一个启动WSL (ubuntu1804)终端的脚本,然后在该终端中运行bash脚本。
.\ubuntu1804.exe;
cd test_directory;
node server.js;但是,在第一个命令打开后,终端将不会执行其他两个命令
发布于 2020-08-25 22:33:38
.\ubuntu1804.exe本身打开一个交互式shell,PowerShell将同步执行该shell。
也就是说,在交互的shell中提交exit以终止它之前,控制不会返回给PowerShell,因此后续的命令-- cd test_directory和note server.js --不仅没有按照您的意愿发送到.\ubuntu1804.exe,而且随后由PowerShell运行。
相反,您必须通过.\ubuntu1804.exe子命令将运行的命令传递给run:
.\ubuntu1804.exe run 'cd test_directory; node server.js'注意:一旦node退出,控件将返回给PowerShell。
https://stackoverflow.com/questions/63587559
复制相似问题