13

I made a batch file trying to setup rake/albacore environment on windows:

@echo off

echo Setting up rake environment for building

echo Installing Bundler
gem install bundler

echo Bundle Installing gems
bundle install

When I run this batch file (either double click or run inside a cmd window), only the first gem command is executed. The 'bundle install' is never called. Here is the output:

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:\>

I have added 'pause' after the first 'gem install' command and it seems the 'pause' is never executed either.

Any idea?

AZ.
  • 7,333
  • 6
  • 44
  • 62
  • It is possible that Gem itself is a batch-file, or that the script is somehow aborting due to a error and not telling you about the error. –  Nov 08 '12 at 00:34

1 Answers1

22

Ahh, I figured it out: just add 'call' before each command.

@echo off

echo Setting up rake environment for building

echo Installing Bundler
call gem install bundler

echo Bundle Installing gems
call bundle install 
AZ.
  • 7,333
  • 6
  • 44
  • 62
  • 4
    seems gem is a batchfile itself. due to the way dos previously operated, for backwards compatibility, this behaviour is by design: http://stackoverflow.com/questions/11638705/why-does-calling-a-nested-batch-file-without-prepending-call-to-the-line-exit – SeanC Nov 07 '12 at 21:07