Sign in to follow this  
Followers 0
ThinkOSX

Run a program with command line arguements.

5 posts in this topic

Greetings

First off, I'd like to apologize for making a topic about this. I've searched for the last 20 mins but have been unable to answer my own question.

What i am attempting to do is when a user clicks a button, a program is installed.

My AutoIt script is in c:\test

The file which i need to run is in c:\test\bin\cc\

I also need to pass command line arguments to it.

I think this issue could be resolved by the workingdirectory parameter but i cant figure out the usage or find an example. I do not want to specify the ENTIRE path. Just bin\cc\ as this will be moved to different computers.

Below is my code.

Thank you in advance.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
$MainPage = GUICreate("VCS Config", 201, 141, -1, -1)
$BUT1_SysInfo = GUICtrlCreateButton("System Info", 8, 8, 185, 25)
$BUT2_InstallCC = GUICtrlCreateButton("Install Calling Card", 8, 41, 185, 25)
$BUT3_InstallOPT = GUICtrlCreateButton("Install Optimization Tools", 8, 73, 185, 25)
$BUT4_EXT = GUICtrlCreateButton("Exit", 8, 106, 185, 25)
GUISetState(@SW_SHOW)
While 1
  
   $msg = GUIGetMsg()
  
   IF $msg = $BUT2_InstallCC Then
   InstallCallingCard()
   ENDIF
  
   IF $msg = $BUT3_InstallOPT Then
   OPTPAK()
   ENDIF
  
   IF $msg = $BUT4_EXT Then
   Exit
   EndIf

WEnd

FUNC InstallCallingCard()
   $FREE = DriveSpaceFree("C:\")
   MsgBox(64,"TotalFree",$FREE)
   RunWait ( "vcscc.msi /norestart /quiet" [, "bin\cc\" ] )
EndFunc 

Func OPTPAK()
   MsgBox(64,"Button 3 Pressed!","Worked!!!")
EndFunc
1 person likes this

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try

@ScriptDir & "bincc"

Or maybe

@WorkingDir & "bincc"

On a second glance you need to remove the square brackets (they are there to denote optional params)

RunWait ( "vcscc.msi /norestart /quiet" ,[ "bincc"] )

More like this

RunWait ( "vcscc.msi /norestart /quiet", @ScriptDir & "bincc")

or if your switches play up maybe

RunWait ( "vcscc.msi" & " /norestart /quiet", @ScriptDir & "bincc")
Edited by Chimaera

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I"m having a similar issue with a large install string.

Runwait('V5_R20_DMU\INTEL\startb.exe' & '-u C:\Program Files\Dassault Systemes\B20_DMU' & '-newdir -ident B20DMU -all -noStartMenuIcon -noStartMenuTools -noDesktopIcon', @ScriptDir)

I've tried a million different combinations of switches and quotes. Can't get it to pass the command line arguements no matter what I do.

Edited by Sam1el

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I"m having a similar issue with a large install string.

Runwait('V5_R20_DMUINTELstartb.exe' &amp; '-u C:Program FilesDassault SystemesB20_DMU' &amp; '-newdir -ident B20DMU -all -noStartMenuIcon -noStartMenuTools -noDesktopIcon', @ScriptDir)

Im no expert with these but this looks a little closer

Runwait(@ScriptDir & 'V5_R20_DMUINTELstartb.exe' & ' -u', 'C:Program FilesDassault SystemesB20_DMU' & ' -newdir -ident B20DMU -all -noStartMenuIcon -noStartMenuTools -noDesktopIcon')

If its not running from the script dir you will need to change the macro to suit, ive added a space in front of your -u and-newdir as they usually start with a space but im not sure about the switches after the DMU part you will have to keep playing

If the switches including the -u are all for the program try this maybe

Runwait(@ScriptDir & 'V5_R20_DMUINTELstartb.exe' & ' -u -newdir -ident B20DMU -all -noStartMenuIcon -noStartMenuTools -noDesktopIcon', 'C:Program FilesDassault SystemesB20_DMU')
Edited by Chimaera

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you so much!!!

That got me on the right track.

It looks like MSI's need to be executed differently than an EXE

I ended up doing:

ShellExecute("msiexec", "/i" & $WorkingDir & "vcscc.msi /quiet")

Edited by ThinkOSX

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0