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

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?  

Keith McElroyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
Run your script as per below:

C:\windows\syswow64\wscript.exe myvbfile.vbs
Keith McElroyAuthor Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Keith McElroyAuthor Commented:
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.
Keith McElroyAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.