Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
Issue with '(' and ')'characters in PAT…

Issue with '(' and ')'characters in PATH system environmental variable while using PVS-Studio with Visual Studio 2008

Dec 08 2010
Author:

At times the users of PVS-Studio static analyzer encounter the following issue while starting the analysis using Visual Studio 2008 IDE.

The analysis does not start and only one message of the following kind is produced

\Utilities\Bin\x86";"C:\WINDOWS\system32";"C:\WINDOWS";
"C:\WINDOWS\System32\Wbem";"C:\Program. was unexpected at this time.

After thoroughly investigating this issue we've determined that such a behavior is caused by an error in one of Visual Studio's environment configuration bat files. And this file is:

..\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat

The PVS-Studio analyzer uses vsvars32.bat file to configure the environment before launching Visual C++ preprocessor. It turns out that this particular issue is caused by the following fragment of the file:

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

The issue will manifest itself if the PATH environmental variable will have been containing the '(' and ')' characters, as if for example Microsoft DirectX SDK will have been included into it - "C:\Program Files\Microsoft DirectX SDK (August 2006)\Utilities\Bin\x86". Than the statement following the 'if' operator

@if not "%WindowsSdkDir%" == "" (
 set "PATH=%WindowsSdkDir%bin;%PATH%"

will be terminated by one of the closing parentheses in PATH, as in this case ..August 2006), which results in the issue at hand.

This leaves us with two solutions of the problem:

  • Remove any path that has '(' and ')' characters from your PATH system environment variable.
  • Rewrite the 'If' statement using goto operator like this:
@if "%WindowsSdkDir%" == "" goto SkipSDKVariableSet

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

:SkipSDKVariableSet

The second path here creates another problem with installation of updates as they could rewrite this code fragment in vsvars32.bat file.

Popular related articles


Comments (0)

Next comments next comments
close comment form