Rick Glos Life in Portland, Oregon.

How to run cmd files from Visual Studio

27. February 2008 13:25 by Rick Glos in

Update: if you are running Visual Studio 2010, I have an update on how this works here.

This will take you a few minutes to setup but once your done, it will save you countless minutes.

It's not unusual to have scripts in your project or solution that automate tasks.  Everything from executing a powershell script, moving files around, or some other custom automation tool you may have written.

The default for double-clicking a cmd file in Visual Studio is for it to open the script for editing.

image

But what if you want to execute it?

One way is to right click the folder above the file, choose 'Open Folder in Windows Explorer', wait for that window to open, find the file with your eyes again, and double-click to execute it.

I tried using the 'Open With...' menu item and adding cmd but it doesn't allow you to pass in the file.

image

So what you end up with is an empty cmd prompt window that hasn't executed the script you thought it would.

Ok great so how did you do it?

On the tools menu you can add external tools and add arguments.  So Tools -> External Tools and a window will open that allows you to run with cmd and also pass in the initial directory as well as some additional arguments.

I created two:

One that terminates the window after executing

TitleRun With Cmd
CommandC:\Windows\System32\cmd.exe
Arguments/C $(ItemPath)
Initial directory$(ItemDir)

image

One that remains after executing

TitleRun With Cmd and Remain
CommandC:\Windows\System32\cmd.exe
Arguments/K $(ItemPath)
Initial directory$(ItemDir)

image

So now you can select the file in solution explorer, then select Tools -> Run With Cmd.

You could go one step further and add it to the context menu.

There's many ways to get into menu customize mode, one way is to choose View -> Toolbars -> Customize.  Make sure to select the 'Context Menus' toolbar and you'll notice a toolbar appear in your menu when you're in customize mode.

image

This next part is tricky.  Leave the customize dialog open - it's semi model, if you close it, you're out of edit mode.  Click Tools -> and you'll see you're new command listed something like 'External Command 3', you'll have to remember which ones you created (or yes you could go and customize that text as well).

Hold down control and left click (we want to copy this to the context menu not move it), slide your pointer over the 'Project and Solution Context Menus' menu item in the context menu toolbar, then down to 'Item', and drop it in there wherever you like.

image

Close the customize dialog.

Now you can right-click on a cmd file in Solution Explorer and select either 'Run With Cmd' or 'Run With Cmd and Remain'.

image

Later

Mileage for week #9

22. February 2008 14:39 by Rick Glos in

We had Monday off out here.  President's Day.  I guess that's what they swap out here in exchange for Good Friday.  So instead of waiting until April for you first day off after New Year's you have to only wait until mid February.

That means I didn't ride Monday.  I've been doing a Mon-Wed-Fri commuting schedule.  20 miles into work.  Hop on the bus to ride the 16 miles from work to downtown Portland.  And then ride the 4 miles all uphill to the house.  Which gives me a 24 mile day, 3 days a week.  The other two I'd like to hit the gym but for now just trying to make sure I don't come up with an excuse not to ride when that alarm goes off at 6am.

So here's the google chart. I had to increase the width by 100 and strip off the week label to get it to look decent.

YearWeekMileage
2008349
 450
 580
 772
 672
 872
 948
2008 Total 443

Attempting to capture the magic of the sunrise again as the sun tried to blast its beams around Mt Hood, whose head was in the clouds.

Mount Hood Sunrise

Later

Heidi gets inked

19. February 2008 21:11 by Rick Glos in

IMG_3389

It's been in the works for 2 years.  When I first moved out here both Heidi and I wanted to get tattoo's.  Life just kept getting in the way.  Finally at the 2 year anniversary of moving here we made appointments at Infinity Tattoo.  I guess when you get tattoo's, and this may be shop dependent, you take a look at the artist and see which one fits your style or can do the work you want done.

We stopped at Sea Tramp Tattoo first and checked them out.  It was a little too rustic for Heidi.  I may go back one day - that place has some history to it.  From the photographs it looked like the original owner did alot of tattoo's for sailors and such.  In fact the guy that will do my tattoo, Tyler Adams, originally started working in Portland at Sea Tramp.

Heidi went with Traci Manley and she did a great job.  She was also good at working with Heidi to make her feel comfortable with the whole process, especially with this being her first tattoo.

Heidi went with a lower back tattoo.  The original inspiration was from some artwork on the back of her Harley-Davidson jacket I bought for her from the company store right before I quit working at Harley to move out here.  She used that with some other ideas and the artist, Traci, drew up a design incorporating her 'hip dimples' and emailed her.

At first Heidi thought it might be a little large but it turned out perfect.

IMG_3375

It took about 2 hours.  About halfway through both girls took a break, the artist as well as the canvas.  At certain points, Heidi said it hurt pretty good.  Basically it feels like a burn she said.

I'm up next on March 8th.  I was think either a bicycle chain armband or something that resembles the bike lane logos they paint on roads to go on my left shoulder.  Like this t-shirt I ordered the other day.  Maybe you have a better idea?

T608T06_lg

Later

Sunrise

15. February 2008 09:46 by Rick Glos in

Seen a couple people run red lights this week.  One guy in Chevy Blazer damn near t-boned me in downtown Portland.  This morning, I almost watched a woman driving a van t-bone a guy in a small truck as she ran through the light when he was turning left...  Need to stay alert as best as possible.

It's all worth it.  I couldn't help but exclaim to some poor guy walking along the sidewalk this morning, "Did you see that sunrise!  Woohoo!".

Sunrise over the Columbia River

Sunrise over the Columbia River

Later

Lance Armstrong and bicycle commuting

15. February 2008 09:39 by Rick Glos in

What do Lance Armstrong and bicycle commuting, two topics you would not have thought to combine together, have in common?  Looks like Lance wants to open up a bike shop in Austin, Texas that will be called Mellow Johnny's in May of 2008 (this year).  Mellow Johnny's is a take off of what's called the "yellow jersey" leader from the Tour de France which is "maillot jaune" in French.

"This city is exploding downtown. Are all these people in high rises going to drive everywhere? We have to promote (bike) commuting," Armstrong said.

Last weekend we had the 4th Annual North American Hand Made Bicycle (site) show here in Portland.  And Lance showed up.  Here's what he had to say when he got back to Austin.

Armstrong said he'd like to see Austin evolve into a place like Portland, Ore., where biking is part of the culture and people pedal to work, to restaurants and to run errands. "Walk outside, and the streets are lined with bikes — because they have a safe place to ride," Armstrong said of the city long known for its bicycle-friendly amenities and policies.

Here's the link to the full article.

Since moving out here my focus has switched more to commuting than to bike racing.  While there's many factors that attribute to that and I'm hoping to balance that out this year with a few more races than last year, commuting has by bike has been a great point of conversation for meeting new people.

It would be great to have a household name like Lance Armstrong to get behind a great alternative to cars.  He could bring lots of money and focus into cycling which could bring better technologies, getting more women to cycle, and more businesses and politicians to take cycling as a serious option to getting back and forth to work and running minor errands.

Later

Visual Studio 2008 - Not enough storage space is available

11. February 2008 10:39 by Rick Glos in

We get a, "Not enough storage space is available" error at the office quite abit, especially with the move to VS 2008 and instead of just passing around the fix internally, I thought I'd post it publicly in case others may find it useful.

We gleaned this information from a forum post on the MSDN message boards here.

Basically, you're going to allow VS to use more memory.  Since we have WinXP boxes with 4GB this is useful.

First, edit your boot.ini file on your C: drive.  Make a backup of the file just in case (copy+paste it in the same directory for example).

Locate your boot.ini

Next, add the 3GB switch option.

Add 3GB switch.

Now we need to use a utility.  Open a command prompt.  And run the editbin utility with the /LARGEADDRESSAWARE switch on the visual studio exe, devenv.exe.

Since they are not in the same folders, specify everything with full paths.  For a majority of you that used the defaults to install, this should work, but change the paths if you need to:

"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\editbin.exe" /LARGEADDRESSAWARE "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

image

Now you need to reboot your machine.

Done.

Later