Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Place the following code at the top of your script to detect if the OS is 64bit then re-run in 32bit mode</p> <pre class="lang-vbs prettyprint-override"><code>' *************** ' *** 64bit check ' *************** ' check to see if we are on 64bit OS -&gt; re-run this script with 32bit cscript Function RestartWithCScript32(extraargs) Dim strCMD, iCount strCMD = r32wShell.ExpandEnvironmentStrings("%SYSTEMROOT%") &amp; "\SysWOW64\cscript.exe" If NOT r32fso.FileExists(strCMD) Then strCMD = "cscript.exe" ' This probably won't work if we can't find the SysWOW64 Version strCMD = strCMD &amp; Chr(32) &amp; Wscript.ScriptFullName &amp; Chr(32) If Wscript.Arguments.Count &gt; 0 Then For iCount = 0 To WScript.Arguments.Count - 1 if Instr(Wscript.Arguments(iCount), " ") = 0 Then ' add unspaced args strCMD = strCMD &amp; " " &amp; Wscript.Arguments(iCount) &amp; " " Else If Instr("/-\", Left(Wscript.Arguments(iCount), 1)) &gt; 0 Then ' quote spaced args If InStr(WScript.Arguments(iCount),"=") &gt; 0 Then strCMD = strCMD &amp; " " &amp; Left(Wscript.Arguments(iCount), Instr(Wscript.Arguments(iCount), "=") ) &amp; """" &amp; Mid(Wscript.Arguments(iCount), Instr(Wscript.Arguments(iCount), "=") + 1) &amp; """ " ElseIf Instr(WScript.Arguments(iCount),":") &gt; 0 Then strCMD = strCMD &amp; " " &amp; Left(Wscript.Arguments(iCount), Instr(Wscript.Arguments(iCount), ":") ) &amp; """" &amp; Mid(Wscript.Arguments(iCount), Instr(Wscript.Arguments(iCount), ":") + 1) &amp; """ " Else strCMD = strCMD &amp; " """ &amp; Wscript.Arguments(iCount) &amp; """ " End If Else strCMD = strCMD &amp; " """ &amp; Wscript.Arguments(iCount) &amp; """ " End If End If Next End If r32wShell.Run strCMD &amp; " " &amp; extraargs, 0, False End Function Dim r32wShell, r32env1, r32env2, r32iCount Dim r32fso SET r32fso = CreateObject("Scripting.FileSystemObject") Set r32wShell = WScript.CreateObject("WScript.Shell") r32env1 = r32wShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") If r32env1 &lt;&gt; "x86" Then ' we are not running in x86 mode, so run in that mode; check if we have done this already For r32iCount = 0 To WScript.Arguments.Count - 1 r32env2 = r32env2 &amp; WScript.Arguments(r32iCount) &amp; VbCrLf Next ' MsgBox "64bit (restarting) " &amp; r32env2 If InStr(r32env2,"restart32") = 0 Then RestartWithCScript32 "restart32" Else MsgBox "Cannot find 32bit version of cscript.exe or unknown OS type " &amp; r32env1 Set r32wShell = Nothing WScript.Quit Else For r32iCount = 0 To WScript.Arguments.Count - 1 r32env2 = r32env2 &amp; WScript.Arguments(r32iCount) &amp; VbCrLf Next ' MsgBox "32bit! " &amp; r32env2 End If 'MsgBox "OS: " &amp; r32env1 &amp; VbCrLf &amp; "Param: " &amp; r32env2 &amp; VbCrLf &amp; "Script: " &amp; WScript.FullName &amp; VbCrLf &amp; "Fullname: " &amp; " " &amp; Wscript.ScriptFullName Set r32wShell = Nothing Set r32fso = Nothing ' WScript.Quit ' ******************* ' *** END 64bit check ' ******************* </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload