Shell.Run and command-line parameters 
Author Message
 Shell.Run and command-line parameters

I am unsuccessfully trying to execute an application using
the Shell.Run command.  the syntax is as follows:
   ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

When I run it without the switches it works, but I need the
switches to perform the custom installation.  Any ideas?

thanks, Joseph



Mon, 03 May 2004 01:43:13 GMT  
 Shell.Run and command-line parameters
I am unsuccessfully trying to execute an application using
the Shell.Run command.  the syntax is as follows:
   ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

When I run it without the switches it works, but I need the
switches to perform the custom installation.  Any ideas?

thanks, Joseph



Mon, 03 May 2004 01:43:13 GMT  
 Shell.Run and command-line parameters
You need to quote your quotes...
ShellObj.Run("""c:\temp\setup.exe -s -q""", 1, True)


Quote:
> I am unsuccessfully trying to execute an application using
> the Shell.Run command.  the syntax is as follows:
>    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

> When I run it without the switches it works, but I need the
> switches to perform the custom installation.  Any ideas?

> thanks, Joseph



Mon, 03 May 2004 02:16:48 GMT  
 Shell.Run and command-line parameters
You didn't say what error you actually get, just that "it doesn't work"...  

Are you sure the setup.exe supports the switches?  

If you enter this at a command prompt

C:> c:\temp\setup.exe -s -q

does it work?

Assuming that c:\temp\setup.exe is the real path to the program, then

exitcode =  ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)
Call ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)
ShellObj.Run "c:\temp\setup.exe -s -q", 1, True

You should also be aware that many setup programs just spawn a secondary process to do the real install, so waiting for completion of setup.exe may not work as expected ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I am unsuccessfully trying to execute an application using
> the Shell.Run command.  the syntax is as follows:
>    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

> When I run it without the switches it works, but I need the
> switches to perform the custom installation.  Any ideas?

> thanks, Joseph



Mon, 03 May 2004 02:39:18 GMT  
 Shell.Run and command-line parameters
No, not in this case.

--
torgeir

Quote:

> You need to quote your quotes...
> ShellObj.Run("""c:\temp\setup.exe -s -q""", 1, True)



> > I am unsuccessfully trying to execute an application using
> > the Shell.Run command.  the syntax is as follows:
> >    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

> > When I run it without the switches it works, but I need the
> > switches to perform the custom installation.  Any ideas?

> > thanks, Joseph



Mon, 03 May 2004 02:51:05 GMT  
 Shell.Run and command-line parameters
Yes, only require extra doublequotes if the command is a long filename
*with spaces in it* (not including spaces to parse command options).
Best description of this is G. Born's:
  Windows Script Host 2.0 Developer's Guide
chapt. 14  "Long Filenames, the At Command, and System Calls"

 - Mitch

Quote:

> No, not in this case.

> --
> torgeir


> > You need to quote your quotes...
> > ShellObj.Run("""c:\temp\setup.exe -s -q""", 1, True)



> > > I am unsuccessfully trying to execute an application using
> > > the Shell.Run command.  the syntax is as follows:
> > >    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

> > > When I run it without the switches it works, but I need the
> > > switches to perform the custom installation.  Any ideas?

> > > thanks, Joseph



Mon, 03 May 2004 03:06:48 GMT  
 Shell.Run and command-line parameters
It doesn't present an error message.  The script just
exits without an error.  The setup along with the switches
work when ran from the command prompt.  Just a bit more
info...the script executes a custom Visio 5 install which,
with the -s switch, calls a setup.iss file with all the
options already selected.  Upon execution it initiates a
silent install.  I know it's not working because there are
no Visio folders created in the Program Files directory
and no icons in the Programs menu and no Visio related
registry entries (my script checks for some of this stuff
and writes it to a log file before it exits).
Quote:
>-----Original Message-----
>You didn't say what error you actually get, just that "it
doesn't work"...  

>Are you sure the setup.exe supports the switches?  

>If you enter this at a command prompt

>C:> c:\temp\setup.exe -s -q

>does it work?

>Assuming that c:\temp\setup.exe is the real path to the
program, then

>exitcode =  ShellObj.Run("c:\temp\setup.exe -s -q", 1,
True)
>Call ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)
>ShellObj.Run "c:\temp\setup.exe -s -q", 1, True

>You should also be aware that many setup programs just

spawn a secondary process to do the real install, so
waiting for completion of setup.exe may not work as
expected ;-)...
Quote:

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




- Show quoted text -

Quote:
>> I am unsuccessfully trying to execute an application
using
>> the Shell.Run command.  the syntax is as follows:
>>    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

>> When I run it without the switches it works, but I need
the
>> switches to perform the custom installation.  Any ideas?

>> thanks, Joseph

>.



Mon, 03 May 2004 07:30:25 GMT  
 Shell.Run and command-line parameters
Try adding this (WSH 5.6 required)...

ShellObj.CurrentDirectory = "c:\temp\"

before you call the Run method...

--
Michael Harris
Microsoft.MVP.Scripting


You didn't say what error you actually get, just that "it doesn't work"...  

Are you sure the setup.exe supports the switches?  

If you enter this at a command prompt

C:> c:\temp\setup.exe -s -q

does it work?

Assuming that c:\temp\setup.exe is the real path to the program, then

exitcode =  ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)
Call ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)
ShellObj.Run "c:\temp\setup.exe -s -q", 1, True

You should also be aware that many setup programs just spawn a secondary process to do the real install, so waiting for completion of setup.exe may not work as expected ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I am unsuccessfully trying to execute an application using
> the Shell.Run command.  the syntax is as follows:
>    ShellObj.Run("c:\temp\setup.exe -s -q", 1, True)

> When I run it without the switches it works, but I need the
> switches to perform the custom installation.  Any ideas?

> thanks, Joseph



Mon, 03 May 2004 10:38:56 GMT  
 Shell.Run and command-line parameters
I have tested it with the following code and it worked fine.

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<script language=VBScript>
dim wsh
set wsh = createobject("WScript.Shell")
wsh.Run "\\shads03\Public\rellang\VS6SP5\enu\cd\setupsp5 /g c:\my.txt", 1,
true
set wsh= nothing
</script>
<P>&nbsp;</P>

</BODY>
</HTML>

It launches the setup for Visual Studio 6.0 SP5 and log the whole process
into a file for troubleshooting.

I don't know what error you are encountering on your side.

Regards,

This posting is provided ?AS IS?, with no warranties, and confers no
rights.



Fri, 07 May 2004 19:38:23 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Sleep command and running a command line in VBScript

2. Parameters in command line location calls

3. reading a parameter from the command line?

4. Command Line Parameters for wsh?

5. Executing vbscript with command line parameters

6. Command Line Parameters

7. Accessing Command-Line parameters from a program.vbs

8. Taking a parameter from the command line

9. Passing parameters from script to command line

10. How do I pass a command-line parameter to my vbs file

11. command line parameters passed to VBS???

12. Passing command line parameters to external program

 

 
Powered by phpBB® Forum Software