Geeks With Blogs
Blake Caraway

Every time I get to a point where I need to commit the code I've been working on (a.k.a 'The Check In Dance'), I typically ALT+Tab over to the explorer window where my source working directory is located. From here I execute our build.bat file that runs the developer build process that compiles the code and runs all the unit and integration tests locally before committing my changes.

I'd rather stay in Visual Studio to do this so I Googled for a solution and of course found that some smart person has already done this. I found Laurent Kempe's blog and he uses PowerShell to execute a batch file from within Visual Studio.

Simply install PowerShell (if you have not done so already). In Visual Studio's solution explorer, find your batch file, right-click it and choose 'Open With...'. Point it to the PowerShell.exe (located after installation by default in %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe). Make it the default app to open that file type with, and it's done. Every time you double click it, PowerShell will execute your .bat file.

I try to keep my hands off the mouse and on the keyboard (home row preferably for shortcuts and such) while coding. This includes doing The Check In Dance. With this tip, I'm able to use the Ctrl+Shift+N Resharper 'Find File' shortcut, punch in build.bat, hit enter, and the build runs. Nice.

You may already have a different/more clever way of doing something similar. If so, leave a comment or better yet, blog it. Thanks to Laurent's blog post, I was able to find a solution in a couple minutes. Thanks Laurent for sharing this tip!


openWith dialog



find buildWindow

Posted on Thursday, August 7, 2008 9:03 PM | Back to top

Comments on this post: Visual Studio and PowerShell Trick

# re: Visual Studio and PowerShell Trick
Requesting Gravatar...
PowerShell is a cool tool, but if you don't already have it, no need to install it just for this.

Create a text file named runner.bat in a safe place on your system (c:\tools) with the following contents:

%COMSPEC% /c %1

Now follow the same Open With instructions above, except point to runner.bat instead of Powershell.exe.
Left by Joshua Flanagan on Aug 08, 2008 8:39 AM

Your comment:
 (will show your gravatar)

Copyright © Blake Caraway | Powered by: