VS2005批处理调用编译命令

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://rabbitlzx.blogbus.com/logs/16816389.html


VCBuild 
示例如下: 
@echo off
if not exist "%vs80comntools%vsvars32.bat" goto missing
call "%vs80comntools%vsvars32.bat"

rem call vcbuild.exe your_sln_name.sln "Your Configuration name " /rebuild

echo **  building XXX **
cd .\XXX\xxx
call vcbuild.exe ".\xxxx.vcproj"   "Release|Win32" /rebuild
cd ..\..\..

rem **  xxx items  **
cd .\xxxxcall vcbuild.exe ".\xxxxsln"   "Release|Win32" /rebuild
cd ..\..

goto :eof

:missing 
echo the visual studio install is missing. 
goto :eof
vcbuild的所有命令如下:
Microsoft (R) Visual C++ Project Builder - Command Line Version 8.00.50727
Copyright (C) Microsoft Corp 1993-2003. All rights reserved.
Usage: vcbuild [options] [project|solution] [config|$ALL]
Options:
/clean (/c)     Clean build outputs only
/error:<str>    Prefix to add to error lines on output to stderr
/errfile:<file> Log all errors to the file specified
/htmllog:<file> Logs output to html file specified
                (default: $(IntDir)\BuildLog.htm)
/implib         Makes an import library for a DLL configuration (does not link)
/info:<str>     Prefix to add to information lines on output to stdout
/link (/l)      Performs a link without building sources
/logcommands    Prints commands and response files to screen
/logfile:<file> Log all output and build information to the file specified
/override:<file>Override the project settings with the settings in the given
                property sheet file
/M<number>      Specifies the number of concurrent builds to run, if possible
/msbuild:<opt>  Pass <opt> to msbuild.exe
/nocolor        Do not output error and warning messages in color
/nohtmllog      Do not write an html build log file
/noimplib       Does not generate an import library.
                NOTE: this option overrides /implib.
/nologo         Suppress version and copyright message
/nondefmsbuild  Do not use the copy of msbuild.exe located in the .NET
                Frameworks installation
/platform:<str> Build only configurations for the given platform
/implibobjs:<s> Additional dependencies for the librarian
/rebuild (/r)   Clean build outputs and perform a build
/forcelink      Forces a link without building sources
/showenv        Show environment in the html build log
/time           Times the build from start to finish
/upgrade        Upgrades the project file to the latest format supported
                NOTE: the upgrade switch does not perform a build
                NOTE: this option is ignored for solution files
/useenv (/u)    Use environment variables for INCLUDE and LIB paths
/wrnfile:<file> Log all warnings to the file specified
/warning:<str>  Prefix to add to warning lines on output to stdout
@<file>         Read options from the specified response file
Default Behavior:
===============================================================================
If no project is specified, and there is only a single .vcproj file in the
directory, that project will be built.
If no configuration is specified, and the VCBUILD_DEFAULT_CFG environment
variable is set, the configuration it specifies will be built. If it is not
set, then all configurations will be built.
The default action is to build the specified configurations without cleaning.
Options will also be read from the VCBUILD_DEFAULT_OPTIONS environment
variable.
===============================================================================

C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages>
DEVENV
也可以使用devenv来进行编译
批处理是直接调用Microsoft Visual Studio 8\Common7\IDE\ 目录内的 devenv.exe ,它启动后就是IDE,提供的参数如下: 
用法: 

devenv [solutionfile | projectfile | anyfile.ext] [switches]

devenv 的第一个参数通常是一个解决方案文件或项目文件。如果您希望在编辑器中自动打开文件,也可以使用任何其他文件作为第一个参数。当您输入项目文件时,IDE会在项目文件的父目录中查找与该项目文件具有相同基名称的 .sln 文件。如果不存在这样的 .sln 文件,IDE 将查找引用该项目的单个 .sln 文件。如果不存在这样的单个.sln 文件,则 IDE 将创建一个具有默认 .sln 文件名且未保存的解决方案,其基名称与项目文件的基名称相同。

命令行编译:

devenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [ /projectconfig name ] ]

 可用的命令行开关:

/Build
 使用指定的解决方案配置生成解决方案或

项目。例如“Debug”。如果可能存在多个平台,

则配置名称必须用引号括起来

并且包含平台名称。例如“Debug|Win32”。
 
/Clean
 删除生成结果。
 
/Command
 启动 IDE 并执行该命令。
 
/Deploy
 生成并部署指定的生成配置。
 
/Edit
 在此应用程序的运行实例中打开

指定文件。如果没有正在运行的实例,

则启动一个具有简化窗口布局的新实例。 
 
/LCID
 设置 IDE 中用于用户界面的默认语言。
 
/Log
 将 IDE 活动记录到指定的文件以用于故障排除。
 
/NoVSIP
 禁用用于 VSIP 测试的 VSIP 开发人员许可证密钥。
 
/Out
 将生成日志追加到指定的文件中。
 
/Project
 指定生成、清理或部署的项目。

必须和 /Build、/Rebuild、/Clean 或 /Deploy 一起使用。
 
/ProjectConfig
 重写解决方案

配置中指定的项目配置。例如“Debug”。如果可能存在

多个平台,则配置名称必须用引号括起来

并包含平台名称。例如“Debug|Win32”。

必须和 /Project 一起使用。
 
/Rebuild
 先清理,然后使用指定配置生成

解决方案或项目。
 
/ResetAddin
 移除与特定外接程序关联的命令和命令用户界面。
 
/ResetSettings
 恢复 IDE 的默认设置,还可以重置为

指定的 VSSettings 文件。
 
/ResetSkipPkgs
 清除所有添加到 VSPackages 的 SkipLoading 标记。
 
/Run
 编译并运行指定的解决方案。
 
/RunExit
 编译并运行指定的解决方案然后关闭 IDE。
 
/SafeMode
 以安全模式启动 IDE,加载最少数量的窗口。
 
/Upgrade
 升级项目或解决方案以及其中的所有项目。

并相应地创建这些文件的备份。有关备份

过程的更多信息,请参见

“Visual Studio 转换向导”上的帮助。
 

 产品特定的开关:

/debugexe
 打开要调试的指定可执行文件。命令行的其余部分作为它的参数传递到此执行文件。
 
/useenv    
 使用PATH、INCLUDE、LIBPATH
 

 要从命令行附加调试器,请使用: 

       VsJITDebugger.exe -p <pid>

 示例代码:

@echo off

if not exist "%vs80comntools%vsvars32.bat" goto missing
call "%vs80comntools%vsvars32.bat"

cd .\Example_\Example_
devenv.com Example_.vcproj /rebuild "release|win32" /out ..\..\output.log
cd ..\..

cd .\TTTT\TTTT
devenv.com TTTT.vcproj /rebuild "release|win32" /out ..\..\output.log

rem build finished
pause

几个问题
1 vcbuild devenv有什么区别?

devenv - it just calls vcbuild to build the C++ projects, but it
can also build MSBuild projects and other visual studio projects that are
neither of the above (e.g. visual studio deployment projects).

vcbuild貌似比devenv快一下,少占用一些资源

2 用devenv.com还是devenv.exe?

If you were to bring up a shell (with devenv.exe and .com in your $PATH), you could type "devenv.com foo.sln /build Debug /out output.log" and have it compile your project from the command line. Caveat - if you don't specify devenv.com, you get devenv.exe, which, for seemingly no good reason, sends it's output somewhere else than stdout, which ensures that you won't see it unless you're running cmd.exe. Always specify devenv.com when building from the command line.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值