看懂的就看吧,看不懂的我也不解释了.

这里留一份以后好抄.

//-----------------------设置编译环境.bat----------------------------

@echo 配置编译环境
@set VS_PATH=D:\Program Files\Microsoft Visual Studio 8
@call "%VS_PATH%\VC\vcvarsall.bat"

//-----------------------重新编译所有.bat----------------------------

@call clean.bat
@call BuildAll_Debug.bat
@call BuildAll_Release.bat

//-----------------------clean.bat----------------------------

del *.aps *.plg *.bsc *.hpj *.clw *.map *.exp *.cbp *.mdp *.ilk *.sbr *.res *.obj *.pch *.pdb *.ncb *.idb *.tmp *.opt mt.dep *.manifest BuildLog.htm /f /s
del *.suo Thumbs.db /f /s /a:h

//-----------------------BuildAll_Debug.bat----------------------------

BuildAll.bat Debug

//-----------------------BuildAll_Release.bat----------------------------

BuildAll.bat Release

//-----------------------BuildAll.bat----------------------------

@call SetupCompliteEnv.bat

@echo 正在编译依赖项
@call BuildExternel.bat %1

@echo 正在编译核心
@call BuildCore.bat %1

@echo 正在编译工具
@call BuildTools.bat %1

@echo 全部编译完毕

//-----------------------BuildCore.bat----------------------------

@call SetupCompliteEnv.bat

@echo 正在编译CEGUI
@devenv CEGUI.sln /build %1

@echo 正在编译OgreNew
@devenv OgreNew.sln /build %1

@echo 正在编译CollisionSystem
@devenv CollisionSystem/CollisionSystem.sln /build %1

@echo 正在编译EditableTerrain
@devenv EditableTerrain/EditableTerrain.sln /build %1

@echo 正在编译OgrePro
@devenv OgrePro/OgrePro.sln /build %1

@echo 正在编译TriggerSystem
@devenv TriggerSystem/TriggerSystem.sln /build %1

@echo 正在编译DisplayLayer
@devenv DisplayLayer.sln /build %1

pause

//-----------------------BuildExternel.bat----------------------------

@call SetupCompliteEnv.bat

@echo 正在编译TinyXML
@devenv Externel/TinyXML.sln /build %1

@echo 正在编译FreeType
@devenv Externel/FreeType.sln /build %1

@echo 正在编译wxWidgets
@if "%1" == "Debug" goto wxWidgetsDebug
@if "%1" == "Release" goto wxWidgetsRelease

: wxWidgetsDebug
@devenv Externel/wxWidgets.sln /build Debug
@devenv Externel/wxWidgets.sln /build "Unicode Debug"
@goto wxWidgetsEnd

: wxWidgetsRelease
@devenv Externel/wxWidgets.sln /build Release
@devenv Externel/wxWidgets.sln /build "Unicode Release"
@goto wxWidgetsEnd

: wxWidgetsEnd

@echo 正在编译XtremeToolkitPro
@devenv Externel\XtremeToolkitPro\Workspace\Resource\Resource_vc80.sln /build Release /project Codejock.ToolkitPro.ResourceZhCn
@devenv Externel\XtremeToolkitPro\Workspace\ToolkitPro\ToolkitPro_vc80.sln /build %1 /project Codejock.ToolkitPro.Shared

//-----------------------BuildTools.bat----------------------------

@call SetupCompliteEnv.bat

@echo 正在编译CEGUI皮肤编辑器
@devenv Tools/CEImagesetEditor.sln /build %1

@echo 正在编译CEGUI界面编辑器
@devenv Tools/CELayoutEditor.sln /build %1


@echo 正在编译世界编辑器
@devenv Tools/WorldEditor/WorldEditor.sln /build %1


//----------------------------------------------------------------

另外,将命令行输出转接到文本中的例子

ping 192.168.1.1 -t >> c:\user.txt

在程序中调用.bat脚本的方法

winexec('c:\a.bat',SW_SHOWNORMAL);

若想关闭命令行不显示,则设置第二个参数为 SW_HIDE.