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.

link|improve this question
2  
It would help if you showed us the relevant line(s) of code. – John Gardeniers Apr 7 '11 at 23:52
feedback

1 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?

link|improve this answer
+1, Same here... works fine. – Chris S Apr 8 '11 at 1:43
Except syswow64 does not exist on Windows 32-bit... so that particular example does not work. – jessicah Apr 9 '11 at 4:42
You said your problem only exists on 64-bit Windows. Why would a sample demonstrating the problem need to run on 32-bit Windows? The question I asked in my answer still stands. Perhaps if you posted your own script, we can analyze what's wrong. – Ryan Bolger Apr 9 '11 at 4:51
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.