Tune Up Your PC

Tune up your PC with our tools and information today!

  • Home
  • About

25

Nov

Not really the last vsvars32 you will ever need

Posted by admin  Published in windows, xp

I took Peter avise and for a while I’ve been using Chris’s vsvars32, however it had some drawbacks,


1. It did not work from a 64bit PowerShell


2. For some reason Get-Batchfile did not work for me, I had to modify to call “echo” explicitly.


I also added a helper VsInstallDir and a alias for devenv.


 Enjoy,


 Oscar


function global:VsInstallDir($version=”10.0″)


{


  $VSKey = $null


  if (test-path HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio$version)


  {


    $VSKey = get-itemproperty HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio$version


  }


  else


  {


    if (test-path HKLM:SOFTWARE\Microsoft\VisualStudio$version)


    {


        $VSKey = get-itemproperty HKLM:SOFTWARE\Microsoft\VisualStudio$version


    }


  }


 


  if ($VSKey -eq $null)


  {


      throw “Visual Studio not installed”


  }


  [System.IO.Path]::GetDirectoryName($VsKey.InstallDir)


}


 


function Get-Batchfile ($file) {


    $cmd = “echo off & `”$file`” & set”


    cmd /c $cmd | Foreach-Object {


        $p, $v = $_.split(’=')


        Set-Item -path env:$p -value $v


    }


}


 


function global:VsVars32($version=”10.0″)


{


  $VsInstallPath = VsInstallDir($version)


  $VsToolsDir = [System.IO.Path]::GetDirectoryName($VsInstallPath)


  $VsToolsDir = [System.IO.Path]::Combine($VsToolsDir, “Tools”)


  $BatchFile = [System.IO.Path]::Combine($VsToolsDir, “vsvars32.bat”)


  Get-Batchfile $BatchFile


  [System.Console]::Title = “Visual Studio shell”


}


 


set-alias devenv ((VsInstallDir)+”\devenv.exe”) -scope global


 

Related Articles

  • I knew where Nepal was before Raiders of the Lost Ark. Did you? (September 3rd, 2010)
  • Steve Marx Reads The Azure Tea Leaves on Connected Show #36 (September 3rd, 2010)
  • Не место красит разработчика, а… (September 3rd, 2010)
  • Quote of the Day: On the Efficiency of Government (September 3rd, 2010)
  • What happens to a named object when all handles to it are closed? (September 3rd, 2010)

No user responded in this post

Subscribe to this post comment rss or trackback url

September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

Blogroll

  • Development Blog
  • Documentation
  • Plugins
  • Suggest Ideas
  • Support Forum
  • Themes
  • WordPress Planet

Categories

  • computers (59)
  • email (3)
  • hardware (17)
  • Operating Systems (1)
  • security (27)
  • software (87)
  • spam (2)
  • technology (93)
  • windows (12402)
  • wireless (3)
  • xp (12397)

Archives

  • September 2010 (75)
  • August 2010 (741)
  • July 2010 (904)
  • June 2010 (594)
  • May 2010 (776)
  • April 2010 (881)
  • March 2010 (728)
  • February 2010 (794)
  • January 2010 (645)
  • December 2009 (710)
  • November 2009 (625)
  • October 2009 (653)
  • September 2009 (622)
  • August 2009 (629)
  • July 2009 (627)
  • June 2009 (652)
  • May 2009 (607)
  • April 2009 (629)
  • March 2009 (465)
  • February 2009 (40)
  • November 2008 (157)
  • October 2008 (140)

Recent Entries

  • I knew where Nepal was before Raiders of the Lost Ark. Did you?
  • What happens to a named object when all handles to it are closed?
  • Quote of the Day: On the Efficiency of Government
  • Не место красит разработчика, а…
  • Steve Marx Reads The Azure Tea Leaves on Connected Show #36
  • This is a really cool panoramic stitching tool!
  • Microsoft Dynamics ERP Licensing Guide
  • Fortnightly MSDN Flash poll
  • Analyzing Database Roundtrips with SQL Server Profiler
  • Windows Identity Foundation Samples–HTTP Watch Is Your Friend

Recent Comments

  • No Comments
  • Random Selection of Posts

    • A “Whiteboard Jam” on Monads and Coordinate Systems
    • Verlängerte Betaphase für Visual Studio 2010 – „Release Candidate“ im Februar 2010
    • Deletion of request in SAP BW orders of magnitude faster after installing SQL Server 2008 SP1 CU6
    • Clustering & High-Availability at TechEd 2010 New Orleans
    • From AJAX back to Client/Server-Style Architectures with Rich Internet Applications (RIAs)
    • Zune HD Level Program Written in XNA
    • CommerceLive: New On-Demand eCommerce Offering from Cactus Commerce
© 2008 Tune Up Your PC is proudly powered by WordPress
Theme designed by Roam2Rome