I'm trying to run a .vbs script under 64Bit. When I run this script manually it will execute properly, but when launched by something else, it will run under 32bit and won't execute properly.
Here's my script:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run Chr(34) & "C:\Users\Chris Nicol\Documents\SlickRun Scripts\Zune\RunZune.bat" & Chr(34), 0
Set WshShell = Nothing
Basically I want to force the use of C:\windows\syswow64\cmd.exe
, so that it will run correctly. I can't seem to get the syntax right and can't find help on this.
Here's the batch file and regedit file that I'm trying to execute:
RunZune.bat:
@ECHO OFF
regedit /s FeaturesOverride.reg
"C:\Program Files\Zune\Zune.exe"
exit
FeaturesOverride.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Zune\Features]
"Channels"="US,CA"
"MusicVideos"="US,CA"
"Picks"="US,CA"
"Podcasts"="US,CA"
"QuickMixLocal"="US,CA"
Best Answer
The following code will check if the system is 64Bit and in this case close the script and rerun it forcing the 64Bit Host by calling it directly with the script as parameter.
This workaround ensures that the script is run in 64Bit no matter who calls it. If you have a situation where you can control the call (e.g. the script is only ever called via a specific link) you can probably just use the basic principle (which is the sysnative file system redirector) directly in your shortcut.