Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a little script I run every now and then, it has never had any problems. I'm on Windows 7 and have used it here as well. It relies on WScript.Shell.

A couple days ago I ran it and it gave back the following message:

---------------------------
wscript.exe - Bad Image
---------------------------
C:\Windows\system32\wshom.ocx is either not designed to run on Windows
or it contains an error. Try installing the program again using the original
installation media or contact your system administrator or the software vendor
for support. 
---------------------------
OK   
---------------------------

Followed by the WScript error:

---------------------------
Windows Script Host
---------------------------
Script: C:\tools\videoconverter.vbs
Line:   9
Char:   1
Error:  Could not create object named "WScript.Shell".
Code:   800700C1
Source:     WScript.CreateObject

---------------------------
OK   
---------------------------

I have tried the following:

  • Did a clean boot with all non-MS services turned off. Still the same error.
  • When I tried to register wshom.ocx I get

[Window Title]
RegSvr32

[Content]
The module "C:\Windows\system32\wshom.ocx" may not compatible with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.

[OK]

My version of windows is x86 - how do I see what version Wshom.ocx is compatible with?Actually though how can it be incompatible given that it was compatible at some recent time in the past?

Edited: adding in the script:

infolder = "c:\tools\music_input"
outfolder = "c:\tools\music_output"

Dim objFSO
Dim ofolder
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("scripting.filesystemobject")
Dim objCurrentFolder
Set objCurrentFolder =  objFSO.getfolder(infolder)
Dim tempval   
Dim nFile
For Each file In objCurrentFolder.Files

nFile = outfolder & "\" &  file.Name & ".mp3"

If objFSO.FileExists(nFile) Then

Else
tempval = "c:\tools\ffmpeg\bin\ffmpeg.exe -i " &  chr(34)  & file & chr(34) & " " &    
chr(34) &  nFile & chr(34)

WshShell.Run tempval
WScript.Sleep 15000
End If                
Next
share|improve this question
    
Bryan, Some questions - have you tried it on another windows computer? can you please provide the script for us to read through? are you getting this error with other scripts that you have written? is this 32bit or 64bit windows? have you had a change in permissions on this computer, as in, you are now not Local Admin? have you copied this script from another computer? Thanks. –  Steve Rathbone Jul 3 '12 at 11:54
    
Yes it works on other windows computers, I've used it for several years on several computers. I can use WScript on the computer but I cannot instantiate a WScript.Shell. I am not local admin, but I have run the script with heightened permissions and no problem. I have also used it without problems for at least half a year on this computer. –  Bryan Rasmussen Jul 4 '12 at 5:25
    
I just tried a script that did nothing but instantiate WScript.Shell and call a bat file. Same error. –  Bryan Rasmussen Jul 4 '12 at 6:32
    
oops when I said I have the script with heightened permissions and no problem actually I meant to write that when I run the script with heightened permissions I get the same error. –  Bryan Rasmussen Jul 4 '12 at 9:36

1 Answer 1

Bryan, what happens if you run:

    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")

    If Err <> 0 Then
    Wscript.Echo Err.Number & " -- " &  Err.Description
    Err.Clear
    End If

Thanks.

share|improve this answer
    
The same as before, First the wscript bad image message, then a wscript error that says Could not create object named "WScript.Shell". With the error on line number 2. –  Bryan Rasmussen Jul 4 '12 at 12:11
    
If I run the script using cscript I get the bad image message box popping up for cscript.exe and then I get the following in the console window: c:\tools>cscript.exe wscriptcheck.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. c:\tools\wscriptcheck.vbs(2, 5) WScript.CreateObject: Could not create object na med "WScript.Shell". c:\tools> –  Bryan Rasmussen Jul 4 '12 at 12:14
    
If I tried the following: 'try { var WshShell = new ActiveXObject("WScript.Shell"); } catch(err) { for(var e in err){ WScript.Echo(err[e]); } } ' I get the following message: Error -2147024703 –  Bryan Rasmussen Jul 4 '12 at 12:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.