How to execute a command line command from a *.HTA 
Author Message
 How to execute a command line command from a *.HTA

Hi,

is there a way to execute a command line command from a *.hta file?
I want to automatically register an ocx.
Manually this is done by typing
RegSvr32 filename.ocx
in the Start-->Run box
How can I do it automatically?
Also if it's manually registered, a confirmation message pops up saying that
all is ok - is it possible to avoid it?

Thanks



Sun, 20 Jul 2003 02:32:11 GMT  
 How to execute a command line command from a *.HTA

filename = chr(34) & "full path to the file to register" & chr(34)
set shell = createobject("wscript.shell")
exitcode = shell.Run("regsvr32.exe /s " & filename, 0, True)

Based on experimentation (regsvr32.exe exitcodes don't seem to be doc'd anywhere)...

exitcode 0 = success
exitcode 1 = invalid switch
exitcode 3 = failure (test using a bad path causes a 3)
exitcode 4 = exported function not found (e.g., DLLRegisterServer) or corrupt in-memory version
(test registering a non-COM dll causes a 4)

I don't what (if any scenario) will generate exitcode 2 or if there are any other failure exitcodes
other than these (for example, Permission denied, LoadLibrary failures, missing/incompatible
dependencies, etc.)

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Hi,

> is there a way to execute a command line command from a *.hta file?
> I want to automatically register an ocx.
> Manually this is done by typing
> RegSvr32 filename.ocx
> in the Start-->Run box
> How can I do it automatically?
> Also if it's manually registered, a confirmation message pops up saying that
> all is ok - is it possible to avoid it?

> Thanks



Sun, 20 Jul 2003 13:40:18 GMT  
 How to execute a command line command from a *.HTA
Thank you, Michael!
I guess there is nothing wrong to register the ocx this way each time the
*.hta file is started and check the exitcode, although the second time it'll
be already registered (just in case the ocx is removed,renamed or whatever).
Is that correct?


Quote:

> filename = chr(34) & "full path to the file to register" & chr(34)
> set shell = createobject("wscript.shell")
> exitcode = shell.Run("regsvr32.exe /s " & filename, 0, True)

> Based on experimentation (regsvr32.exe exitcodes don't seem to be doc'd
anywhere)...

> exitcode 0 = success
> exitcode 1 = invalid switch
> exitcode 3 = failure (test using a bad path causes a 3)
> exitcode 4 = exported function not found (e.g., DLLRegisterServer) or

corrupt in-memory version
Quote:
> (test registering a non-COM dll causes a 4)

> I don't what (if any scenario) will generate exitcode 2 or if there are

any other failure exitcodes
Quote:
> other than these (for example, Permission denied, LoadLibrary failures,

missing/incompatible
Quote:
> dependencies, etc.)

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --




Quote:
> > Hi,

> > is there a way to execute a command line command from a *.hta file?
> > I want to automatically register an ocx.
> > Manually this is done by typing
> > RegSvr32 filename.ocx
> > in the Start-->Run box
> > How can I do it automatically?
> > Also if it's manually registered, a confirmation message pops up saying
that
> > all is ok - is it possible to avoid it?

> > Thanks



Sun, 20 Jul 2003 19:09:10 GMT  
 How to execute a command line command from a *.HTA
I tried to do that very thing in an HTA after reading this request, but
it failed.  Every time I put the SET line into the script and run it an
empty IE window opens full screen and no Msgbox appears.  The funny
thing is that commenting out the line has no effect.  Removing the line
(after the HTA has been run at least once) still results in an empty IE
window, but it's not full screen.  I wonder what's broken on my Win 98SE
box.  

I'll post the 'hello world' test script I used in a new thread to see if
someone can find an error in the code.

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Quote:

> filename = chr(34) & "full path to the file to register" & chr(34)
> set shell = createobject("wscript.shell")
> exitcode = shell.Run("regsvr32.exe /s " & filename, 0, True)

> Based on experimentation (regsvr32.exe exitcodes don't seem to be doc'd anywhere)...

> exitcode 0 = success
> exitcode 1 = invalid switch
> exitcode 3 = failure (test using a bad path causes a 3)
> exitcode 4 = exported function not found (e.g., DLLRegisterServer) or corrupt in-memory version
> (test registering a non-COM dll causes a 4)

> I don't what (if any scenario) will generate exitcode 2 or if there are any other failure exitcodes
> other than these (for example, Permission denied, LoadLibrary failures, missing/incompatible
> dependencies, etc.)

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --


> > Hi,

> > is there a way to execute a command line command from a *.hta file?
> > I want to automatically register an ocx.
> > Manually this is done by typing
> > RegSvr32 filename.ocx
> > in the Start-->Run box
> > How can I do it automatically?
> > Also if it's manually registered, a confirmation message pops up saying that
> > all is ok - is it possible to avoid it?

> > Thanks



Sun, 20 Jul 2003 23:03:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Executing command to command line from VB App

2. Passing values into and out of Command Line application *and* command line prompt in vbscript

3. Scripting command line applications & Command Line Prompting

4. accessing hta command line arguments from an htc

5. HTA: Read Command Line Before Window Is Displayed

6. Command line args or common dialogs in a HTA

7. HTA: Read Command Line Before Window Is Displayed

8. HTA: Read Command Line Before Window Is Displayed

9. Help with Win 95 screen saver command line - command line.zip [1/1]

10. How to execute a command line in VBscript

11. Executing vbscript with command line parameters

12. Executing command-line instructions / Adding NT users and setting directory permissions via CGI or ISAPI

 

 
Powered by phpBB® Forum Software