The following steps allow you to select a .cmd file in you Visual Studio project and execute it in the Visual Studio Output window. To run a command (.cmd) or batch (.bat) file in the Visual Studio Output window, select your command file in the Solution Explorer window and press Alt-T+B.
Run commands in the Visual Studio "Output" window.
- Open Visual Studio.
- Click Tools.
- Click External Tools.
- Click Add.
- Enter the following values:
- Title: Run Selected &Batch
- Command: %SystemRoot%\system32\cmd.exe
- Arguments: /C $(ItemFileName)
- Initial directory: $(ItemDir)
- Check the Use Output window option.
- Click OK to save.
Alternate:
Enter the following values:
- Title: Run Selected &Batch
- Command: %SystemRoot%\system32\cmd.exe
- Arguments: /K $(ItemPath)\$(ItemFileName)
- Initial directory: $(ItemDir)
- Check the Use Output window option.
- Click OK to save.