我有一个问题,每次调用另一个批处理文件后,我的批处理过程都会中断。批处理文件用于从 IBM Rhapsody 运行生成过程。将调用从 Rhapsody 转换为 Visual Studio 工具。因此,在进行不同的设置后,将从批处理中调用 nmake。
脚本不是完全由我编写的,我只调整主题以在 Windows 架构版本 x86 和 x64 下运行。第一个脚本(vs2005_make.bat)将从 Rhapsody 调用并运行到“call”语句。第二个脚本 (Vcvars_VisualStudio2005.bat) 运行到最后。但是第一个脚本没有恢复工作,此时进程中断而没有错误消息。
我对批处理文件不是很熟悉,这是我第一次在批处理文件中制作不仅仅是简单的控制台命令。所以我希望我已经提供了所有需要的信息,否则问我。
这里是启动脚本(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
这里是被调用的脚本(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
这里是控制台输出,这里我不明白,觉得很可疑的是,在第一个脚本中的“IF %ERRORLEVEL%”语句之后,无论回显是否设置为关闭,都会全部输出......</p>
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
我希望有人有一个想法,我现在工作两天了,没有发现错误......谢谢你的期待。
注意:单词“Mehr?” 在文本输出中是德语,意思是“更多”。我不知道它是从哪里来的,它可能是从英语输出到德语的错误翻译。