'gem install'后批处理文件不运行下一个命令

时间:2012-11-07 18:44:28

标签: batch-file gem

我创建了一个批处理文件,尝试在Windows上设置rake / albacore环境:

@echo off

echo Setting up rake environment for building

echo Installing Bundler
gem install bundler

echo Bundle Installing gems
bundle install

当我运行此批处理文件(双击或在cmd窗口内运行)时,只执行第一个gem命令。永远不会调用'bundle install'。这是输出:

C:\>InstallGems.bat
Setting up rake environment for building
Installing Bundler
Successfully installed bundler-1.2.1
1 gem installed
Installing ri documentation for bundler-1.2.1...
Installing RDoc documentation for bundler-1.2.1...

C:\>

我在第一个'gem install'命令后添加了'pause',似乎'暂停'也从未执行过。

有什么想法吗?

1 个答案:

答案 0 :(得分:20)

啊,我想通了:只需在每个命令之前添加'call'。

@echo off

echo Setting up rake environment for building

echo Installing Bundler
call gem install bundler

echo Bundle Installing gems
call bundle install