问题
In Visual Studio, using External Tools, is it possible to have a tool set up to execute multiple .bat files?
I have two .bat files in my project directory and I currently have a tool for each of them set up, so I go up to Tools and select each one. I was trying to find a way to run both .bat files at once without creating a third .bat file just to call those .bat files.
Each one individual has the Command pointed to the cmd.exe, and their Arguments as /C filename.bat
Is there a way to pass in both of the .bat files to have them run sequentially (or in parallel, I'm not picky) or will I need to create a third .bat file to point to each of them?
回答1:
Use the &
chaining commands operator; or better yet the &&
conditional chaining operator that only invokes the second command when the first one has successfully run (exit code is 0).
Try it first in the command line
start cmd /c "so1 && so2"
if you have problems with competing quotes (the case when the commands themselves need to use quotes), you can also escape with ^
the &
character
start cmd /c so1 ^& so2
finally set your new external tool arguments to the syntax that better fits your requirements, probably /c "so1 && so2"
will be enough.
来源:https://stackoverflow.com/questions/35208311/how-to-run-multiple-batch-files-with-single-external-tool-in-visual-studio