vb script run on 64 bit machine but use 32 bit so create mdb will work

Keith McElroy
Keith McElroy used Ask the Experts™
Is there a way to run a vbs script from within a file such as myscript.vbs that would use the 32 bit script tool so that I do not need to send my user to the command prompt?  

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mohammed KhawajaManager - Infrastructure:  Information Technology

Run your script as per below:

C:\windows\syswow64\wscript.exe myvbfile.vbs


Can I run this sequence from a .vbs file in some way?  Maybe declard the syswow64 so user does not need to go to the cmd prompt?
you might have to create a shortcut to: (per mohammed's instructions)
C:\windows\syswow64\wscript.exe myvbfile.vbs

or you can add this to the top of you vbs

Sub Force32bit() 
	If CreateObject("Scripting.FileSystemObject").FolderExists("C:\Windows\SysWOW64") Then 
		If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 Then
			Dim objShell : Set objShell = CreateObject("WScript.Shell") 
			objShell.CurrentDirectory = "C:\Windows\SysWOW64" 
			objShell.Run "cscript.exe " & WScript.ScriptFullName
		End If 
	End If 
End Sub 


Open in new window


I think this is what I need, question though, why is this if statement here

If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 Then

Is it assuming I put SYSTEM32 in the file name of the script?

May I remove this if statement?

Thanks for clarification.


I've requested that this question be closed as follows:

Accepted answer: 250 points for mnkhawaja's comment #a41402168
Assisted answer: 250 points for brendanmeyer's comment #a41402327
Assisted answer: 0 points for maxdbase's comment #a41402728

for the following reason:

Both answers equally great, I am going to use the short cut initially but later go with the in-scrpt method

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial