Re: .vbs file only locks up inside a batch file.. why?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chris Barber (chris_at_blue-canoe.co.uk.NOSPAM)
Date: 03/04/04


Date: Thu, 4 Mar 2004 23:48:03 -0000

I tried it and got the same effect (WinXP Pro) - a divorced cscript.exe
instance in the Task Manager indicating that the script engine instance was
being held open.

NB: The CD drawer does close with the double .Eject method in the script.

Chris.

"Robert Cohen" <dont@want.spam.com> wrote in message
news:uJ9vfAjAEHA.3004@TK2MSFTNGP10.phx.gbl...
Sorry, didn't read your vb script better; here is your answer; you can close
the cd player with the script only to open it. See link.
http://www.waxy.org/archive/2003/03/27/open_cdr.shtml

But for your questions:

actually I mentioned the logging on only in passing. I have a logon.bat for
a logon script. I use that to run different vbs at logon.

yeah I could do batch mode over interactive, but I like to see what is going
on. batch mode will suppress any errors and I won't see it.

to be honest I don'tremember what exactly "%0\..\" does; I think it says
that the vbs file is in the same folder that the bat file is run from

Robert Cohen
A legend in his own mind

--
"JP" <sendmenospam@getlostscum.com> wrote in message
news:cPudnXkthLkPCNrdRVn-gw@comcast.com...
> Please refresh my memory.  Does %0 expand to the full path?  I'm not
> sure what logging on has to do with my script?  I plan to make this an
> desktop shortcut or keystroke shortcut. I understand nologo for a
> cleaner display, but why the interactive mode?
>
> Robert Cohen wrote:
>
> > this is what I do to call a vbs from a batch file for a logon script:
> >
> > cscript //i //nologo %0\..\closecdroms.vbs
> >
> > --
> > Robert Cohen
> > A legend in his own mind
> > --
> >
> > "JP" <sendmenospam@getlostscum.com> wrote in message
> > news:RKidnWlPa5iE6drdRVn-gg@comcast.com...
> >
> >>The code shown below is totally baffling this novice.  The purpose of
> >>the code is to close ALL the cd-rom trays on my local computer.  Simple
> >>enough, right?  No matter how its executed, all the code inside the vbs
> >>file runs just fine.  I know this because it gets to the last line,
> >>which is a test message that gets displayed.  But to get the vbs file to
> >>release control back the batch file that it was called from, I have to
> >>run win-xp's task  manager and delete the cscript.exe or wscript.exe
> >>process.  Only then does the rest of my batch file run.  I have another
> >>clue.  By process of elimination, I found the code that causes the vbs
> >>file to "stall":
> >>
> >>colCDROMs.Item(i).Eject : colCDROMs.Item(i).Eject
> >>
> >>But when I put the code back, it closes the cd tray like it should.  The
> >>really waky part is that the vbs file doesn't lockup at the above line.
> >>  I even waited 20 minutes for the vbs file to close the cscript.exe
> >>program.  I can see the "imapi.exe" execute and close in the task
> >>manager list.  I have tried running the batch file several different
> >>ways.  I have clicked on it in explorer, used the run command in the
> >>start menu, and even opened a command prompt and hand typed the batch
> >>file and pressed enter.  Same result.
> >>
> >>This is not my code.  I found it at several places on the web.  Plase
> >>edit as needed.  Any help would be appreciated.  Let me know if you need
> >>more info.
> >>
> >>
> >>>'    CLOSECDROMs.VBS
> >>>
> >>>dim oWMP
> >>>dim colCDROMs
> >>>dim i
> >>>
> >>>Set oWMP = Wscript.CreateObject("WMPlayer.OCX.7")
> >>>Set colCDROMs = oWMP.cdromCollection
> >>>
> >>>if colCDROMs.Count >= 1 then
> >>>
> >>>For i = 0 to colCDROMs.Count - 1
> >>>colCDROMs.Item(i).Eject : colCDROMs.Item(i).Eject
> >>>Next ' cdrom
> >>>
> >>>End If
> >>>
> >>>oWMP.close
> >>>set colCDROMs = nothing
> >>>set oWMP = nothing
> >>>set i = nothing
> >>>wscript.echo "CLOSECDROMs: Test Message....  It got here."
> >>
> >>
> >>>@echo off
> >>>rem cderase.bat
> >>>rem
> >>>rem
> >>>rem close cd/dvd drives
> >>>cscript "closecdroms.vbs"
> >>>echo It Never gets here!
> >>>rem
> >>>rem
> >>>rem erase o: cd drive, eject tray afterwards
> >>>createcd -v -erase -r:o -eject
> >>
> >>JP
> >>
> >>
> >
> >
> >
>


Relevant Pages

  • Re: .vbs file only locks up inside a batch file.. why?
    ... didn't read your vb script better; here is your answer; you can close ... But to get the vbs file to ... >>>release control back the batch file that it was called from, ... >>>>rem close cd/dvd drives ...
    (microsoft.public.scripting.vbscript)
  • Identifying if login script is running on a server or workstation.
    ... Im working on migrating or script from a batch file to a vbs file. ... script is going to map drives and log certain infomation about the PC ...
    (microsoft.public.scripting.vbscript)
  • RE: Deleting file that is In use under Windows 2003 Server
    ... > files to unzip I had forgotten to add the switch to overwrite if file ... Anyway, it looks like the script hung there, but I set ... > Task Manager to kill the script if it runs for an hour, ... and now when I try to open this batch file it says it's in use by ...
    (microsoft.public.windows.server.scripting)
  • RE: Deleting file that is In use under Windows 2003 Server
    ... > files to unzip I had forgotten to add the switch to overwrite if file ... Anyway, it looks like the script hung there, but I set ... > Task Manager to kill the script if it runs for an hour, ... and now when I try to open this batch file it says it's in use by ...
    (microsoft.public.windows.server.general)
  • ActiveX - WScript in HTML file rendered by VBS File
    ... The script calls a batch file from DRA. ... news items to the user as one of these modules. ... unread messages in an instance of InternetExplorer called from the vbs file. ...
    (microsoft.public.scripting.wsh)