Second command prompt not closing after installation completed

#1
Am creating a batch script to install ruby gems along with some other automation. But when "gem install <gemname>" command triggered its opened new command prompt to install and its not closing it as soon as gem installation completed.

I tried below things as well which didn't help me,

START /WAIT /b gem install --no-rdoc --no-ri json
START /WAIT gem install --no-rdoc --no-ri json /b

Can someone help me out to get the additional command prompt closed as soon as installation completed
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#2
Can I ask why you're even using the START command to begin with?
 


Neemobeer

Windows Forum Team
Staff member
#3
Yeah you shouldn't need Start at all. If you want to explicitly close the cmd just add exit at the end of the batch file
 


#4
Okay. I tried without using START and below the current script.

@echo OFF
echo Installing Gems
gem install --local --quiet --no-rdoc --no-ri ffi-1.9.10-x86-mingw32.gem ffi-1.9.10-x64-mingw32.gem
echo Completed Gems installation



Once the gem installation completed am not getting the message "Completed Gems installation". Below is the output of this script,

c:\temp>gem_install.bat
Installing Gems
Successfully installed ffi-1.9.10-x86-mingw32
Successfully installed ffi-1.9.10-x64-mingw32
2 gems installed

c:\temp>
 


Last edited:

Josephur

Windows Forum Admin
Staff member
Premium Supporter
#5
I mean... your "2 gems installed" message is just as good as "Completed Gems installation"

You can also redirect text to a file in batch scripting then use the type command to display it.

The only thing I can think of as far as your second echo not working correctly is that the gem command is altering the command prompt space somehow therefore breaking it. You could try an "ECHO ." after it which might mitigate the problem..

Or you can try something like this...
@echo OFF
@echo Installing Gems >> install.log
@gem install --local --quiet --no-rdoc --no-ri ffi-1.9.10-x86-mingw32.gem ffi-1.9.10-x64-mingw32.gem >> install.log
@echo Completed Gems installation >> install.log
@echo Installation results:
@type install.log
 


#6
Hmm I also suspect gem command is altering the command prompt behavior. I tried the method which you suggested and getting the same result only.

Below is the output I got in install.log file.

Installing Gems
Successfully installed ffi-1.9.10-x86-mingw32
Successfully installed ffi-1.9.10-x64-mingw32
2 gems installed
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#7
You should look into the cmd /k option.

cmd /k gem install --local --quiet --no-rdoc --no-ri ffi-1.9.10-x86-mingw32.gem ffi-1.9.10-x64-mingw32.gem >> install.log
 


#8
Cool.. It worked. Thanks a lot!
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.