Why does calling gem.bat from a cmd file exit after the first call?
I'm calling gem
commands in a Windows .cmd
file, but it exits after the first command. What gives?
gem sources --add http://gems.github.com
gem install h开发者_如何学Pythonaml
The gem
command is actually a batch file in your PATH
. For example, C:\Ruby192\bin\gem.bat
. Calling a batch file like this from a batch/cmd file automatically exits the entire session at the end of the called batch file. There is a special command that returns to the calling batch/cmd file. Use the CALL
command before every call to another batch file.
CALL gem sources --add http://gems.github.com
CALL gem install haml
I solved it by calling the first gem
command through cmd.exe
, but I'm still keen to hear explanations of what is going on.
cmd.exe /c gem sources --add http://gems.github.com
gem install haml
精彩评论