Visual Studio - Run Batch File

后端 未结 5 2267
别跟我提以往
别跟我提以往 2021-02-07 08:04

What I would like

I would like to easily run a batch file without leaving Visual Studio. The batch files are not always the same, they change depending on the solutio

5条回答
  •  醉梦人生
    2021-02-07 08:18

    The best way to proceed is to write an external tool, and then you can pass in parameters based on your current solution that is loaded.

    There are many project and solution specific variables you can pass to your external tool. Open up the 'External Tools' dialog, and select your tool in the list box. You will see the title of your external tool, as well as the command that points to the script or batch script you want to call. The arguments edit box has a button next to it with an arrow next to it. Click the arrow and you will see a big list of variables, or parameters, you can pass to your external tool.

    So, for instance you can use the following:

    $(ProjectDir) - The full path directory of the project you are working on. for instance "C:\builds\myproject"

    $(ProjectPath) - The full path name of the vcproj you are working on. for instance "C:\builds\myproject\foo.vcproj"

    $(ProjectName) - The name of the project. for instance "foo"

    $(SolutionDir) - The full path directory of the solution that is currently loaded. for instance "C:\builds\mysolution"

    etc...

提交回复
热议问题