locked
command prompt of VS2008 doesn't owrk -- vsvars32.bat returns errors RRS feed

  • Question

  •  

    Hello,

    have any one seen such problem.

     

    I have winxp sp2, vs2008 ts. The windir is c:\winnt. after installing vs2008, the commad prompt isn't setup correct because cl.exe can not be found.

     

    I tried to run "vsvars32.bat" from a cmd window and got following. The "vsvars32.bat" isn't executed correctly. Do you know what might be wrong?

     

    Thanks in advance for any help!

     

    Output of running "vsvars32.bat":

    >SET VSINSTALLDIR=c:\Program Files\Microsoft Visual Studio 9.0
    >SET VCINSTALLDIR=c:\Program Files\Microsoft Visual Studio 9.0\VC

    >SET FrameworkDir=c:\WINDOWS\Microsoft.NET\Framework

    >SET FrameworkVersion=v2.0.50727
    >SET Framework35Version=v3.5

    >if "c:\Program Files\Microsoft Visual Studio 9.0" == "" goto error_no_VSINSTALLDIR
    >if "c:\Program Files\Microsoft Visual Studio 9.0\VC" == "" goto error_no_VCINSTALLDIR

    >echo Setting environment for using Microsoft Visual Studio 2008 x86 tools.
    Setting environment for using Microsoft Visual Studio 2008 x86 tools.

    >call :GetWindowsSdkDir
    >call :GetWindowsSdkDirHelper HKLM  1>nul 2>&1

    >if errorlevel 1 call :GetWindowsSdkDirHelper HKCU  1>nul 2>&1

    >if errorlevel 1 set WindowsSdkDir=c:\Program Files\Microsoft Visual Studio 9.0\VC\PlatformSDK\
    >exit /B 0

    \Utilities\Bin\x86";C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\WINNT\system32;C:\WIN
    NT;C:\WINNT\System32\Wbem;C:\Program Files\PC-Doctor for Windows\services;C:\Pro
    gram Files\ATI Technologies\ATI Control Panel C:\2sdk1.4.2_07\bin;C:\Program Fil
    es\Intel\Wireless\Bin\;C:\Program Files\ThinkPad\ConnectUtilities;C:\Program Fil
    es\Intel\Wireless\Bin\;C:\Program Files\Intel\Wireless\Bin\;c:\Program Files\Mic
    rosoft SQL Server\90\Tools\binn\" was unexpected at this time.

    >     set "PATH=C:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;"C:\Program Files\Microsoft DirectX
     SDK (April 2006)\Utilities\Bin\x86";C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\WINN
    T\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\PC-Doctor for Window
    s\services;C:\Program Files\ATI Technologies\ATI Control Panel C:\2sdk1.4.2_07\b
    in;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\ThinkPad\ConnectUtiliti
    es;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Intel\Wireless\Bin\;c:\
    Program Files\Microsoft SQL Server\90\Tools\binn\"

    >

    Friday, April 18, 2008 3:36 PM

Answers

All replies

  • Did you install the Windows SDK for Windows Server 2008 after you installed Visual Studio 2008? There is a known issue with this scenario, in which vcvars32.bat becomes corrupted.  If this is your scenario, you can find an explanation and easy workaround on this forum post Workaround: Install WinSDK for SVR2008 after VS2008 breaks VS command line build environment (vcvars32.bat)

     

    -Karin

     

    ||Karin Meier||Windows SDK PM||Build Environment.Samples.Community|| http://blogs.msdn.com/KarinM||

     

    Friday, April 18, 2008 9:58 PM
  • I verified that this doesn't work for me. My vsvars.bat is the same as the correct one.

    SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0
    SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0\VC
    SET FrameworkDir=C:\WINNT\Microsoft.NET\Framework
    SET FrameworkVersion=v2.0.50727
    SET Framework35Version=v3.5
    if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
    if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

     

    Is there any reason for a "call :GetWindowsSdkDir" to fail to return?

    >call :GetWindowsSdkDir
    >call :GetWindowsSdkDirHelper HKLM  1>nul 2>&1

    >if errorlevel 1 call :GetWindowsSdkDirHelper HKCU  1>nul 2>&1

    >if errorlevel 1 set WindowsSdkDir=c:\Program Files\Microsoft Visual Studio 9.0\VC\PlatformSDK\
    >exit /B 0

    \Utilities\Bin\x86";C:\PROGRAM

     

    See the code snippet from my vsvars.bat:

    call :GetWindowsSdkDir

    if not "%WindowsSdkDir%" == "" (
     set "PATH=%WindowsSdkDir%bin;%PATH%"
     set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
     set "LIB=%WindowsSdkDir%lib;%LIB%"
    )

    :GetWindowsSdkDir
    call :GetWindowsSdkDirHelper HKLM > nul 2>&1
    if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
    if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\
    exit /B 0

    • Proposed as answer by devguy71 Wednesday, February 2, 2011 12:58 AM
    Tuesday, April 22, 2008 5:16 PM
    1. This may be a different problem than the one I linked to above, which is an issue with VCvars32.bat.  If you think your issue might have been caused by installing the Windows SDK, please answer the following questions so we can determine if your problem is related to a known issue.

      1. Did you install the Windows SDK for Windows Server 2008 after you installed Visual Studio 2008?
      2. Is the Server 2008 SDK the only Windows SDK you have installed?
      3. VSvars32.bat (in title of your post) is not the same as VCvars32.bat (which we've identified a bug with). 
      4. You mentioned that VSvars.bat is the same as the "correct one."  What do you mean by the "correct one" and where did you find the VSvars.bat that you compared it to?
      5. I have a VSvars32.bat on my system in C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools, but no VSvars.bat.  Is VSvars32.bat the file you looked at?  If so, can you look at \Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat?

       -Karin

       

      ||Karin Meier||Windows SDK PM||Build Environment.Samples.Community|| http://blogs.msdn.com/KarinM

    Wednesday, April 23, 2008 2:15 AM
  • I have found the same problem.

    After some investigations, i found that the error is in these lines of vsvars32.bat:


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


    The problem seems to be with the parenthesis in if stantment. (actually i never used this sintax in my batch files, but i used goto instead.)
    Replacing previous lines with following ones will solve the problem.

    @if "%WindowsSdkDir%" == "" goto NoSDK

    @set "PATH=%WindowsSdkDir%bin;%PATH%"
    @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
    @set "LIB=%WindowsSdkDir%lib;%LIB%"

    :NoSDK

    Warning becouse i fixed my vsvars32.bat file some weeks ago, but just today (probably after installing VS2008 features pack??) i found it still bugged.


    I hope someone in microsoft will fix the problem and explain it!!!

    Beppe
    • Proposed as answer by devguy71 Wednesday, February 2, 2011 1:00 AM
    Thursday, April 24, 2008 3:10 PM
  • It’s difficult for me to troubleshoot a problem if you say “I have the same problem.”  There are several different problems being discussed in this thread.  For us to understand your problem, you must provide us with enough details to reproduce the problem.  If you refer to a particular file, provide the full path name (C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vcvars32.bat), and be careful to spell the file name correctly and completely.  Don’t refer to “vcvars.bat” if you really mean “vcvars32.bat”).

     

    1.       What exactly do you think your problem is?

    2.       What are the symptoms of your problem?

    3.       What is the error message you see?

    4.       What were you trying to accomplish when you first noticed the problem?

    5.       What is your computer setup?

    6.       Operating System

    7.       Platform architecture (x86, X64, IA64)

    8.       version of Visual Studio (was it installed to a custom directory? Did you deselect some features?)

    9.       Version of the Windows SDK (was it installed to a custom directory? Did you deselect some features?)

    10.   Do you have other versions of VS or the Windows SDK installed?

    11.   Which did you install first, VS or the Windows SDK?

    12.   Was your system working correctly at one time?

    13.   Did you change anything that you think may have affected your system?

    14.   Have you installed any service packs or feature packs recently?

     

    --Karin

     

    ||Karin Meier||Windows SDK PM||Build Environment.Samples.Community ||http://blogs.msdn.com/KarinM||

     

     

    Thursday, April 24, 2008 3:26 PM
  • Dear Karin,

    probably i didn't explain well: my post was a reply to original poster (jennj)

    i told that i've found the same problem of jennj (vsvars32.bat doesn't work) and i told als i've understand the source of the problem.

    My post is only to help jennj to solve his problem and (if possible) to help microsoft to patch the bugged version of file vsvars32.bat distributed with vs2008.

    The bugged file is %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
    (please note that vSvars32.bat isn't an error: this batch is called from %ProgramFiles%\Microsoft Visual Studio 9.0\VC\bin\vCvars32.bat)


    If you watch the content of vsvars32.bat you can found these lines:

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

    As i told in my previous post, the problem is that on my PC (win XP pro SP2) this sintax of if stantment with parenthesis doesn't work. I've replaced these lines with:

    @if "%WindowsSdkDir%" == "" goto NoSDK

    @set "PATH=%WindowsSdkDir%bin;%PATH%"
    @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
    @set "LIB=%WindowsSdkDir%lib;%LIB%"

    :NoSDK

    Beppe

    Tuesday, April 29, 2008 7:10 AM
  •  

    Hi Beppe,

     

    I have just installed VS2008 on windows server 2003 and have exactly the same problem. Making your change seems to slove the problem.

     

    I simply put the DVD in and did the default installation. The only difference is that %programfiles% is on the E: drive not the C: drive

     

    I already have VS 6, 7, and 8 also installed perhaps this is the problem.

     

    Thanks for the post.

    Tuesday, April 29, 2008 11:47 AM
  • ok, so I've now gone a bit deeper and think I have found the problem in my case. Basically the problem isn't with the braces per say, it's the setting of the PATH variable within them. ie the line

     

    set "PATH=%WindowsSdkDir%bin;%PATH%"

     

    This works fine on it's own but if the path variable contains braces already then you get a problem.

     

    Here is what this cmd looks like expanded out on my machine.

     

    C:\Documents and Settings\Administrator>    set "PATH=E:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E:\Program Files\Microsoft Visual Studio 9.0\V
    C\VCPackages;E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E:\
    Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;E:\Program Files\\Microsoft SDKs\Win
    dows\v6.0A\bin;E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E
    :\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;E:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;E:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;"E:\Program Files\Microsoft DirectX SDK (December 2005)\Utilities\Bin\x86"; C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\program files\Microsoft Visual SourceSafe;E:\Program Files\Microsoft SQL Server\90\Tools\binn\"

     

    The problem here is that the braces get closed by the final brace in this text:

     

    E:\Program Files\Microsoft DirectX SDK (December 2005)

     

    causing the message:

     

    \Utilities\Bin\x86";C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\program files\Microsoft Visual SourceSafe;E:\Program Files\Microsoft SQL Server\90\Tools\binn\" was unexpected at this time.

    Your fix that removes the braces "works around" this problem well. Perhaps it's time for Microsoft to add to this discussion again now. Any comments welcome?
    Tuesday, April 29, 2008 12:21 PM
  • Thanks all.

    Removing the braces indeed fixed my problem.

     

    I'd like a fix from MS because I couldn't fix this for my customers.

    Friday, May 2, 2008 4:39 PM
  • I recently installed VS 2008 Professional.
    I did not install any SDK's afterwards.
    I do have previous Windows SDK's installed.
    I also have VS 6.0, VS 2003, and VS 2005 installed on this same computer.

    I can confirm that I am experiencing this same "bracket" error.
    The error is the one experienced in the first post above.  I wont repeat it in full here.

    The error was not the vcvars32.bat one that you referred to in:
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3204202&SiteID=1&mode=1

    The error still occured when I explicitly ran:
    \program files\Microsoft Visual Studio 9.0\Common Tools\vsvars32.bat


    One of the items in my %Path% string  before running this vsvars32.bat file is:
    "c:\program files\Microsoft DirectX SDK (October 2006)\Utilities\bin\x86"

    Notice the parentheses in this string.

    If I remove this single directory entry from my path prior to running the vsvars32.bat file, then the batch file succeeds.

    I hope this is helpful.


    Thursday, May 22, 2008 7:48 PM
  •  I am trying to install X.509 certificate on my machine but im getting this error

    C:\AzureServicesKit\Labs\IntroServiceBus\Setup>setlocal

    C:\AzureServicesKit\Labs\IntroServiceBus\Setup>cd C:\AzureServicesKit\Labs\Intro
    ServiceBus\Setup\

    ====================================================
    Remove Existing X.509 Certificates
    ====================================================

    The system cannot find the path specified.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.

    ====================================================
    Install X.509 Certificates
    ====================================================

    'makecert.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'makecert.exe' is not recognized as an internal or external command,
    operable program or batch file.
    'certmgr.exe' is not recognized as an internal or external command,
    operable program or batch file.
    Please review messages above.
    ======================================
    Press any key to continue . . .

    Monday, December 8, 2008 12:17 PM
  • you are correct the path gets too long for the parenthesized syntax and cmd barfs.  The goto syntax works.  devdiv needs to make this change to the shipping version of the batch file permanent.
    Wednesday, February 2, 2011 1:01 AM