Batch break up after call other batch file
- by Sven Arno Jopen
i have the problem, that my batch process breaking up each time after call a other batch file. The batch files are used to run a make process out from IBM Rhapsody. There convert the call from Rhapsody to the Visual Studio tools. So nmake will be called from the batch after make different settings.
The scripts aren’t written completely from me, I only adapt theme to run under both windows architecture versions, x86 and x64. The first script (vs2005_make.bat) will be called from Rhapsody and run to the “call” statement. The second script (Vcvars_VisualStudio2005.bat) runs to the end. But the first script isn’t resume working, at this point the process break up without a error message.
I'm not very familiar with batch files, this is the first time I make more than simple console commands in a batch file. So I hope I have given all information’s which needed, otherwise ask me.
Here the start script (vs2005_make.bat):
:: parameter 1 - Makefile which should be used
:: parameter 2 - The make target mark
@echo off
IF "%2"=="" set target=all
IF "%2"=="all" set target=all
IF "%2"=="build" set target=all
IF "%2"=="rebuild" set target=clean all
IF "%2"=="clean" set target=clean
set RegQry="HKLM\Hardware\Description\System\CentralProcessor\0"
REG.exe Query %RegQry% > checkOS.txt
Find /i "x86" < CheckOS.txt > StringCheck.txt
IF %ERRORLEVEL%==0 (
set arch=x86
) ELSE (
set arch=x64
)
call "%ProgramFiles%\IBM\Rhapsody752\Share\etc\Vcvars_VisualStudio2005.bat" %arch%
IF %ERRORLEVEL%==0 (
set makeflags=
nmake /nologo /S /F %1 %target%
)
del checkOS.txt
del StringCheck.txt
exit
and here the called script (Vcvars_VisualStudio2005.bat):
:: param 1 - Processor architecture
@echo off
ECHO param 1 = %1
IF %1==x86 (
SET ProgrammPath=%ProgramFiles%
) ELSE IF %1==x64 (
SET ProgrammPath=%ProgramFiles(x86)%
) ELSE (
ECHO Unknowen architectur
EXIT /B 1
)
SET VSINSTALLDIR="%ProgrammPath%\Microsoft Visual Studio 8\Common7\IDE"
SET VCINSTALLDIR="%ProgrammPath%\Microsoft Visual Studio 8"
SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
SET FrameworkVersion=v2.0.50727
SET FrameworkSDKDir="%ProgrammPath%\Microsoft Visual Studio 8\SDK\v2.0"
rem Root of Visual Studio common files.
IF %VSINSTALLDIR%=="" GOTO Usage
IF %VCINSTALLDIR%=="" SET VCINSTALLDIR=%VSINSTALLDIR%
rem
rem Root of Visual Studio ide installed files.
rem
SET DevEnvDir=%VSINSTALLDIR%
rem
rem Root of Visual C++ installed files.
rem
SET MSVCDir=%VCINSTALLDIR%\VC
SET PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%Common7 \Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%;
SET INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\gl;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE%
SET LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB%
GOTO end
:Usage
ECHO. VSINSTALLDIR variable is not set.
ECHO.
ECHO SYNTAX: %0
GOTO end
:end
Here the console output, what I not understand here and find very suspicious is that after the “IF %ERRORLEVEL%” Statement in the first script all will be put out regardless the echo is set to off…
Executing: "C:\Programme\IBM\Rhapsody752\Share\etc\vs2005_make.bat" Simulation.mak build
IF %ERRORLEVEL%==0 (
Mehr? set arch=x86
Mehr? ) ELSE (
Mehr? set arch=x64
Mehr? )
call "%ProgramFiles%\IBM\Rhapsody752\Share\etc\Vcvars_VisualStudio2005.bat" %arch%
:: param 1 - Processor architecture
@echo off
ECHO param 1 = %1
param 1 = x86
IF %1==x86 (
Mehr? SET ProgrammPath=%ProgramFiles%
Mehr? ) ELSE IF %1==x64 (
Mehr? SET ProgrammPath=%ProgramFiles(x86)%
Mehr? ) ELSE (
Mehr? ECHO Unknowen architectur
Mehr? EXIT /B 1
Mehr? )
SET VSINSTALLDIR="%ProgrammPath%\Microsoft Visual Studio 8\Common7\IDE"
SET VCINSTALLDIR="%ProgrammPath%\Microsoft Visual Studio 8"
SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
SET FrameworkVersion=v2.0.50727
SET FrameworkSDKDir="%ProgrammPath%\Microsoft Visual Studio 8\SDK\v2.0"
rem Root of Visual Studio common files.
IF %VSINSTALLDIR%=="" GOTO Usage
IF %VCINSTALLDIR%=="" SET VCINSTALLDIR=%VSINSTALLDIR%
rem
rem Root of Visual Studio ide installed files.
rem
SET DevEnvDir=%VSINSTALLDIR%
rem
rem Root of Visual C++ installed files.
rem
SET MSVCDir=%VCINSTALLDIR%\VC
SET PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%;
SET INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\gl;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE%
SET LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB%
GOTO end
Build Done
I hope someone have an idea, i work now since two days and don't find the error... thanking you in anticipation.
Note: The word “Mehr?” in the text output is german and means “more”. I don't know were it comes from and it is possible that it is a bad translation from the English output to german.