Windows – How to run a 32-bit app from VBScript on both 32-bit & 64-bit Windows

vbscriptwindows

What is the best way to invoke a 32-bit command with Shell.Run in VBScript such that it will succeed on both Windows 32-bit and 64-bit operating systems?

On 64-bit, the app terminates because it's not a 64-bit process. Whilst I could use c:\windows\syswow64\cscript.exe myscript.vbs, this isn't portable to Windows 32-bit.

Best Answer

I can't reproduce the problem you're describing on my system. If I write a VBScript to invoke the 32-bit version of Notepad in %windir%\syswow64 using Shell.Run, it works just fine despite the fact that the scripting host is 64-bit and Notepad is 32-bit.

Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "%windir%\syswow64\notepad.exe"

What 32-bit command are you trying to invoke that is failing?