Wscript help please!

Associate
Joined
6 Feb 2004
Posts
1,357
Location
Toon
Hi all

I'm trying to get a script to work on a 64-bit machine, basically at work we have several scripts we need to run which update information in Access databases, and as more and more machines are running x64 I want to be able to update the scripts so they work on this environment. Problem is nobody (including me!) knows anything about scripting.

I wasn't going to let that stop me though :D so I found this this link

When I initially tried running it, it failed giving the error Line: 1 Char: 50 Error: Expected end of statement. The 50th character in line1 for me is a semicolon, changing it to a colon seemed to get the script to run further, so I guess this may have helped?!

I'm now stuck on line 4, I get the error below:

1.jpg


My line 4 currently reads:

if(host.indexOf("system32") != -1 && cpu == "amd64")

Help!
 
Last edited:
Hi all

I'm trying to get a script to work on a 64-bit machine, basically at work we have several scripts we need to run which update information in Access databases, and as more and more machines are running x64 I want to be able to update the scripts so they work on this environment. Problem is nobody (including me!) knows anything about scripting.

I wasn't going to let that stop me though :s so I found this this link

When I initially tried running it, it failed giving the error Line: 1 Char: 50 Error: Expected end of statement. The 50th character in line1 for me is a semicolon, changing it to a colon seemed to get the script to run further, so I guess this may have helped?!

I'm now stuck on line 4, I get the error below:

1.jpg


My line 4 currently reads:

if(host.indexOf("system32") != -1 && cpu == "amd64")

Help!

shouldn't it be:

if((host.indexOf("system32") != -1) && (cpu == "amd64"))
 
The issue here is that you've saved it as a VBScript file and it's not VBScript; that looks like JavaScript (or Microsoft's JScript implementation perhaps?). Leave the code as it is on the site, save the file with a .js extension and you're sorted.

Integrating this in to other scripts may be problematic, however, if they don't use the same language.
 
Oh I see (I think). So if I have several VBscript files that currently don't run on x64 ( I get the error 'Provider cannot be found. It may not be properly installed'), but work fine on x86, how to I get them to run?
 
I don't suppose you could post the contents of the files for me to take a look at, could you? All ours seem to work fine on either architecture.
 
Hi Mate - I trusted you a message with one example, the code isn't particularly confidential, but I'm not sure I should post it on a public forum. Interested to hear your thoughts.
 
Aha. It seems to be an issue that people have had before.

http://social.msdn.microsoft.com/fo.../thread/372f6d82-ed6c-41f7-aec7-6d7bebbb93ca/

Seems that there's no simple one-click solution, but this works on my system (up until the point that it tries to access the database file and points out that it doesn't exist):

http://stackoverflow.com/questions/...a-vbscript-in-32-bit-mode-on-a-64-bit-machine

If you just want people to be able to double-click something to run, the best way to do it may be to creat a small batch file containing the relevant commands. The following would easily do the trick assuming that's the same problem with all of the scripts you need to run:

Code:
@echo off
C:\windows\syswow64\wscript.exe file.vbs
 
Hi Mate

I had worked that out, only problem is the script must be located in the same folder as the database in order to work. This would vary on each users machine, so that 'file.vbs' part would need to specifically point to the folder locating the script and the database.
 
How do they run the script at the moment? Do they just go in to the folder and run it from there? I suppose you could manually add it (or get them to add it) for each individual machine, or standardise the location. Depends which option is easier really.
 
Neither is really an option unfortunately, never mind, I assumed this was going to be easier than it actually is. Thanks for your help though.
 
Actually JHeaton I just tried adding C:\windows\syswow64\wscript.exe file.vbs to a batch file and that does work as long as the batch file which executes the vbs exists in the same folder as the script. This is the best workaround for me I think, so thanks!
 
Back
Top Bottom