Page 1 of 1

64-bit Bug / Cscript.exe Tool output

Posted: Thu Oct 06, 2011 11:30 pm
by ds0934
If you run the following code on a Windows 7 64-bit computer using the latest version of TextPad, it displays incorrect results for expanded environment variables through VBscript (cscript.exe). If you run the same code outside of TextPad it displays correctly.

Code: Select all

Set objShell = CreateObject("Wscript.Shell")
wscript.echo objShell.ExpandEnvironmentStrings("%programfiles%")
wscript.echo objShell.ExpandEnvironmentStrings("%programfiles(x86)%")
within TextPad, it shows...

C:\Program Files (x86)
C:\Program Files (x86)

Running the same script from within a CMD console...

C:\Program Files
C:\Program Files (x86)

Posted: Fri Oct 07, 2011 7:22 am
by ben_josephs
That is not a bug and it's not TextPad that's doing it. TextPad is a 32-bit application. Windows arranges things so that when a 32-bit application thinks it's looking at the directory "C:\Program Files" it's actually looking at the directory "C:\Program Files (x86)".