如何在Windows 7命令提示符下运行.sh ?当我试着在里面运行这一行的时候总是会得到这个错误,

app/build/build.sh

错误,

'app' is not recognized...

or,

bash app/build/build.sh

错误,

'bash' is not recognized...

知道我错过了什么吗?

这里是截屏,


当前回答

Windows中的新功能-在Windows的ubuntu上运行bash -在Build会议后的Windows 10“Insiders”版本中可用:

https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/

其他回答

运行.sh文件最常见的方法是使用sh命令:

C:\>sh my-script-test.sh 

另一个好的选择是安装CygWin

在Windows中,家庭位于:

C:\cygwin64\home\[user]

例如,我使用bash命令执行my-script-test.sh文件:

jorgesys@INT024P ~$ bash /home/[user]/my-script-test.sh 

Windows中的新功能-在Windows的ubuntu上运行bash -在Build会议后的Windows 10“Insiders”版本中可用:

https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/

您是否尝试过通过对.sh所在的根目录进行压缩以从那里执行它,而不是像您在问题中所示的那样写下文件的路径?

像这样:

$ cd app/build
$ build.sh

在Windows操作系统下安装github工具。在安装Git的环境变量“System”中设置如下路径。

<程序文件在C:\>\Git\bin

<程序文件在C:\>\Git\usr\bin

在cmd窗口中键入'sh'重定向到Bourne shell并在终端中运行您的命令。

只要安装git,然后通过bash <name.sh>"运行你的.sh文件。