I want to verify an installation on a windows (XP) machine. So i want to create a .bat file that does the work.
I want to verify commands like
jruby --version
and echo "OK" if it gives reasonable output. So in pseudocode:
if( `jruby --version`.startsWith("jruby 1.5.6") then
开发者_如何学Goecho "OK"
else
echo "FAIL: Jruby not working!"
Any ideas on how to make that comparison in a bat file?
@echo off
jruby --version 2>&1 | findstr /I /C:"jruby 1.5.6" > nul
if %errorlevel% == 0 (
echo "OK"
) else (
echo "FAIL: Jruby not working!"
)
pause
精彩评论