Search code examples
vbscriptshelllaunchwow64

How to launch a Vb script that runs in 64 bit mode from a vbscript running under Wow64


I have a VB script that's being forced to run in Wow64 mode. I'd like to have it start either another script, or itself, in native 64 bit mode. Is there anyway to do that?

The initial script is being called by an explicit call to cscript.exe (not sure if this makes a difference or not)

Thanks


Solution

  • Apparently its pretty simple.

    In Windows Vista and newer there is an alias folder at C:\Windows\Sysnative. If you call it it will not redirect to the c:\windows\SysWow64 32 bit folder but will force the native 64 bit executables to be called

    http://msdn.microsoft.com/en-us/library/aa384187(VS.85).aspx

    Therefore, you can run a vbscript in 64 bit mode from a vbscript running in wow64 mode by calling %windir%\Sysnative\cscript.exe and then providing the name of your script as a parameter.

    However, this only works in Windows Vista or newer. There is a hotfix which can enable this Sysnative folder in Windows XP/2003

    http://support.microsoft.com/kb/942589