如何为 Visual Studio 命令提示符创建批处理文件 [英] How to create a Batch File for Visual Studio Command Prompt

查看:38
本文介绍了如何为 Visual Studio 命令提示符创建批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 Visual Studio 2008 x64 交叉工具命令提示符 创建一个批处理文件,以便在我的 PC 上继续执行某些操作,这里是 senario.

I want to create a batch file for Visual Studio 2008 x64 Cross Tools Command Prompt to do something continuesly in my PC, here is the senario.

svn update
delete some files
MSBuild MySolutiuon.sln
delete some files
xcopy somefiles
MSBuild AutomateBuildConfiguration.xml /p:Configuration=Release
xcopy some files
delete somefiles
xcopy some files

create a Zip file if it is possible // it is not neccessary

我可以使用简单的命令提示符和 MSBuild 部分 使用 Visual Studio 命令提示符来完成大部分工作,但是由于这两个提示符不同,我无法完成我的 senario.

I can do most of it with simple Command Prompt and MSBuild parts with Visual Studio Command Prompt, but as these two prompt are different I cannot complete my senario.

我已经测试了所有命令并且对我来说效果很好,如果您知道我该怎么做,请给我一个解决方案.

I have tested all command and work great for me, Give me a solution if you know what should I do.

我检查了这个并且没有理解任何东西提前谢谢您

I checked this and didn't underestand anything Thank you in advance

推荐答案

让你的批处理文件的第一行设置 VS 环境:

Make the first line of your batch file set up the VS environment:

call "C:Program FilesMicrosoft Visual Studio 2008VCvcvarsall.bat" x86_amd64
svn update
delete some files
MSBuild MySolutiuon.sln
... more commands ...

x86_amd64 是用于 x64 交叉工具命令提示符的参数.

x86_amd64 is the argument used for x64 Cross Tools Command Prompt.

一旦 vcvarsall.bat 运行,msbuild 将在批处理文件中其余命令的路径中可用.

Once vcvarsall.bat has run, msbuild will be available in the path for the rest of the commands in your batch file.

或者,如果您不使用 Visual C++,您可能更喜欢使用此行设置环境(而不是调用 vcvarsall.bat):

Alternatively, if you aren't using Visual C++, you might prefer to set up the environment with this line (instead of the call to vcvarsall.bat):

对于 VS 2008:

For VS 2008:

call "%vs90comntools%vsvars32.bat"

对于 VS 2010:

For VS 2010:

call "%vs100comntools%vsvars32.bat"

对于 VS 2012:

For VS 2012:

call "%vs110comntools%vsvars32.bat"

对于 VS 2013:

For VS 2013:

call "%vs120comntools%vsvars32.bat"

对于 VS 2015:

For VS 2015:

call "%vs140comntools%vsvars32.bat"

对于 VS 2017:

For VS 2017:

Batch 现在被称为 vc 而不是 vs.

Batch is now called vc not vs.

call "%vs140comntools%....VCAuxiliaryBuildvcvars32.bat"

或更好

call "%vs140comntools%VsDevCmd.bat"

这篇关于如何为 Visual Studio 命令提示符创建批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆