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.
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)".