Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running WSH scripts under Win64

141 views
Skip to first unread message

Alex Blekhman

unread,
Feb 7, 2010, 12:26:23 PM2/7/10
to
Hello,

I have a couple of .WSF files that work properly under Win32.
These files reference Msxml2.DOMDocument.4.0 object. Under Win64
WSH refuses to run the script with the error:

Windows Script Host: Cannot find the type library for this
reference : Msxml2.DOMDocument.4.0

When I run a file with 32-bit WSH host explicitly (via
%WINDIR%\SysWOW64\Cscript.exe), then everything works fine.

Here's the example .WSF file:

------- XmlTest.wsf -------
<job id="main">
<?job debug="true"?>
<reference object="Msxml2.DOMDocument.4.0" />
<object id="xmlDoc" progid="Msxml2.DOMDocument.4.0" />

<script language="JScript">

</script>
</job>
---------------------------

I don't want to specify 32-bit explicitly every time. What should
I do in order to run this script under Win64?

Thanks in advance
Alex

Alex Blekhman

unread,
Feb 7, 2010, 1:24:49 PM2/7/10
to
"Alex Blekhman" wrote:
> I don't want to specify 32-bit explicitly every time. What
> should I do in order to run this script under Win64?

OK, I found that MSXML 4.0 does not exist under 64-bit Windows. I
need to move to MSXML 6.0 or fall back to MSXML 3.0, which exist
in both flavours of Windows.

Alex

mayayana

unread,
Feb 7, 2010, 5:44:58 PM2/7/10
to
>
> OK, I found that MSXML 4.0 does not exist under 64-bit Windows. I
> need to move to MSXML 6.0 or fall back to MSXML 3.0, which exist
> in both flavours of Windows.
>
...Or just associate .vbs files with the 32-bit
version of WScript.exe permanently. If you want
to run 64-bit (with no particular benefit) you're
going to be limited in what you can use. Most
64-bit Windows software also exists in 32-bit.
Most 32-bit software -- from anyone -- does not
exist in 64-bit.


Alex Blekhman

unread,
Feb 8, 2010, 4:16:20 AM2/8/10
to
"mayayana" wrote:
> ...Or just associate .vbs files with the 32-bit version of
> WScript.exe permanently. If you want to run 64-bit (with no
> particular benefit) you're going to be limited in what you can
> use.

I want to run it regardless of the Windows version. These scripts
may be used by any member of our team on a variety of PC boxes:
from 32-bit XP to 64-bit 2008 Server. That's why it is important
for me to make the execution transparent for a user.

Alex

mayayana

unread,
Feb 8, 2010, 9:43:25 AM2/8/10
to

> I want to run it regardless of the Windows version. These scripts
> may be used by any member of our team on a variety of PC boxes:
> from 32-bit XP to 64-bit 2008 Server. That's why it is important
> for me to make the execution transparent for a user.
>

I don't think you have much choice.

1) You can set all PCs to default to wscript (or cscript)
32-bit. (Then you can set them back in 2018 when
64-bit becomes relevant. :)

2) You can write the scripts to adapt to the system.
That means that on 64-bit you'll never be able to use
any objects except those Microsoft objects that come
in 64-bit.

I don't know offhand how you identify 64-bit via
script. But if you use method #2 you'd have to do
that, essentially having dual scripts that fork to separate
routines once the system version has been ascertained.


Alex Blekhman

unread,
Feb 8, 2010, 10:35:18 AM2/8/10
to
"mayayana" wrote:
> That means that on 64-bit you'll never be able to use any
> objects except those Microsoft objects that come in 64-bit.

I am perfectly fine with this. My question was not about any
ActiveX object in general, but specifically about MSXML object.
MSXML 6.0 is available on all version of Windows used in our team.

Thanks
Alex

James Whitlow

unread,
Feb 21, 2010, 10:30:30 AM2/21/10
to

"Alex Blekhman" <tkfx....@yahoo.com> wrote in message
news:erO5tqBq...@TK2MSFTNGP05.phx.gbl...

> Hello,
>
> I have a couple of .WSF files that work properly under Win32. These files
> reference Msxml2.DOMDocument.4.0 object. Under Win64 WSH refuses to run
> the script with the error:
>
> Windows Script Host: Cannot find the type library for this reference :
> Msxml2.DOMDocument.4.0
>
> When I run a file with 32-bit WSH host explicitly (via
> %WINDIR%\SysWOW64\Cscript.exe), then everything works fine.

Have you tried not explicitly specifying the version and letting windows
choose the active version?

<reference object="Msxml2.DOMDocument" />
<object id="xmlDoc" progid="Msxml2.DOMDocument" />


Alex Blekhman

unread,
Feb 21, 2010, 12:31:24 PM2/21/10
to
"James Whitlow" wrote:
> Have you tried not explicitly specifying the version and
> letting windows choose the active version?
>
> <reference object="Msxml2.DOMDocument" />
> <object id="xmlDoc" progid="Msxml2.DOMDocument" />

The problem is that versionless declaration defaults to MSXML 3.0.
For my script I need at least version 4.0 - some of the features
I use are available only in version 4.0 and higher.

Thanks
Alex

James Whitlow

unread,
Feb 21, 2010, 1:58:00 PM2/21/10
to

"Alex Blekhman" <tkfx....@yahoo.com> wrote in message
news:%23WjSyux...@TK2MSFTNGP02.phx.gbl...

You might consider trapping the error & then checking the variable type.
If the object is successfully instantiated, you should have an 'object'
variable type. If you don't, try the other version. I write in VBScript, so
I am not sure how to do it in JavaScript.

Also, I don't have a 64-bit version of Windows, but my 32-bit version of
XP has the 6.0 version of MSXML installed. I don't remember explicitly doing
this, so I assume it go installed with a Service Pack or security patch. If
this is true of your workstations, you could try the 6.0 on the 32-bit
versions of Windows to see if it works as expected.


Alex Blekhman

unread,
Feb 22, 2010, 3:59:44 AM2/22/10
to
"James Whitlow" wrote:
> Also, I don't have a 64-bit version of Windows, but my 32-bit
> version of XP has the 6.0 version of MSXML installed. I don't
> remember explicitly doing this, so I assume it go installed with
> a Service Pack or security patch. If this is true of your
> workstations, you could try the 6.0 on the 32-bit versions of
> Windows to see if it works as expected.

This is exactly what I did as I described in my other post. Now my
script uses MSXML 6.0 by default. This version of MSXML is
available on all our workstations. I comes with many MS products
by default.

Thanks
Alex

0 new messages