2

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

  
4
  • 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. Jul 3, 2012 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. Jul 4, 2012 at 5:25
  • I just tried a script that did nothing but instantiate WScript.Shell and call a bat file. Same error. Jul 4, 2012 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. Jul 4, 2012 at 9:36

0

You must log in to answer this question.

Browse other questions tagged .