Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't want to modify the system path in Windows 7, or the user path either.

But when I start up a Command Prompt (cmd.exe), I would like the path within the command prompt to be modified to include a couple of additional directories on the path that I would like searched for when I type in commands.

I thought earlier versions of Windows had the ability via a .pif file, and there used to be an ability to put variables in the autoexec.bat (though that might have set the variables for all windows apps and this I want to avoid.

share|improve this question
add comment

migrated from stackoverflow.com Jan 6 '12 at 5:45

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 2 down vote accepted

Interesting question. I just did some reverse engineering on VS Command Prompt, coz it does some thing similar. The short cut for this command prompt targets one batch file.

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

Following is some sample script which gets called eventually

  @echo Setting environment for using Microsoft Visual Studio 2010 x86 tools.
  @call :GetVSCommonToolsDir
  @if "%VS100COMNTOOLS%"=="" goto error_no_VS100COMNTOOLSDIR

  @call "%VS100COMNTOOLS%VCVarsQueryRegistry.bat" 32bit No64bit

  @if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
  @if "%FrameworkDir32%"=="" goto error_no_FrameworkDIR32
  @if "%FrameworkVersion32%"=="" goto error_no_FrameworkVer32
  @if "%Framework35Version%"=="" goto error_no_Framework35Version

  @set FrameworkDir=%FrameworkDir32%
  @set FrameworkVersion=%FrameworkVersion32%

  @if not "%WindowsSdkDir%" == "" (
      @set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%"
          @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
      @set "LIB=%WindowsSdkDir%lib;%LIB%"
  )

So you can have batch file similar to this, and every time to go to command prompt, you can use this.

Hope this helps you.

share|improve this answer
    
Yep, that will work, as long as I always launch the command prompt from my custom shortcut, which isn't a big deal. –  MarkS Jan 6 '12 at 15:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.