What Was I Thinking?

Follies & Foils of .NET Development

  Home  |   Contact  |   Syndication    |   Login
  74 Posts | 0 Stories | 192 Comments | 0 Trackbacks

News

Archives

Post Categories

Check These Out

Gurus

If you want to run a batch (.bat) file from within Visual Studio, you need to add an external tool.

 

From the Tools menu select External Tools, and then click Add.

Fill out the values as illustrated below:

AddExternalTool AddExternalTool

 

Click OK to close the dialog.

 

Now you can select the bat file to run in solution explorer, and select the Run Batch File command from the Tools menu.  The output of the batch file will be echoed to the output window inside visual studio.

 

<Revised 6/2/10>

You can also run .bat files from the solution explorer directly by associating the default behavior of “.BAT” extensions to Powershell.

 

  1. Right click the batch file in the Solution Explorer
  2. Select “Open With…”  from the context menu
  3. Click “Add…”
  4. In the “Program name” textbox , specify the full path of PowerShell (“\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”)
  5. In the “Friendly name” textbox enter “PowerShell”
  6. Select “Set As Default”
  7. Click OK

Now when you double click your batch file in the solution explorer, it will shell out to powershell and execute.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Thursday, January 28, 2010 12:29 PM

Feedback

# re: Running Batch Files from the Solution Explorer in Visual Studio 3/31/2011 11:05 AM blair rewards membership
Thank you for the tips. I had several problems trying to use .bat files with Visual Studio, to ease my work. I would like you to post here a list of helpful and common commands that can be used in batch files, besides changing path or creating log files.

# re: Running Batch Files from the Solution Explorer in Visual Studio 6/21/2011 9:11 AM surf
Thanks a lot!

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: