none
VBScript - ExpandEnvironmentStrings("%PROGRAMFILES%") Returns Different Result Between Debug and Run Mode

    Question

  • I'm debugging vbscript with Microsoft Visual Studio 2010 Professional...

    In Debug Mode:

    objShell.ExpandEnvironmentStrings("%PROGRAMFILES%") = "C:\Program Files (x86)"

    In Run Mode:

    objShell.ExpandEnvironmentStrings("%PROGRAMFILES%") = "C:\Program Files"

    What's up with that?  I need it to be the same result regardless of how the script is executing.

    Help.

    • Moved by Shanks ZenModerator Monday, October 15, 2012 2:57 AM VBScript issue (From:Visual Basic General)
    • Moved by Bill_Stewart Monday, October 15, 2012 5:16 PM Move to more appropriate forum (From:The Official Scripting Guys Forum!)
    Saturday, October 13, 2012 10:22 PM

Answers

  • In VS 2010 debug builds default to x86, so your debug exe is seeing the x86 program files.

    The release build is probably AnyCPU, which is running in 64 bits and so sees the other path.

    Change your project settings so that they both use x86 or AnyCPU. I think you lose some debugging abilities in VS2010 if your debug is not x86, such as Edit and Continue.

    • Proposed as answer by jrv Monday, October 15, 2012 11:14 AM
    • Marked as answer by Shanks ZenModerator Monday, October 22, 2012 3:09 AM
    Sunday, October 14, 2012 9:35 AM

All replies

  • In VS 2010 debug builds default to x86, so your debug exe is seeing the x86 program files.

    The release build is probably AnyCPU, which is running in 64 bits and so sees the other path.

    Change your project settings so that they both use x86 or AnyCPU. I think you lose some debugging abilities in VS2010 if your debug is not x86, such as Edit and Continue.

    • Proposed as answer by jrv Monday, October 15, 2012 11:14 AM
    • Marked as answer by Shanks ZenModerator Monday, October 22, 2012 3:09 AM
    Sunday, October 14, 2012 9:35 AM
  • Hi Rpearsall222,

    this issue is related to VBScript, in order to provide better support, I will move this thread to The Official Scripting Guys Forum!.

    Thanks for understanding!


    Shanks Zen
    MSDN Community Support | Feedback to us

    Monday, October 15, 2012 2:56 AM
    Moderator
  • Not a scripting issue - this is a pure issue of Visual Studio functionality. VBS under VS is used for web developpment.  This forum is an admin scripoting forum and not a web scripting forum.

    This issue can only be correctly addressed in the devleopers forum.


    ¯\_(ツ)_/¯

    Monday, October 15, 2012 11:13 AM