rahuroy Posted January 25, 2011 Share Posted January 25, 2011 Hi I am new to Autoit ...I have to install exe using param as IGNORE_ERRORS=1..How to do tht? $Ini = @ScriptDir & "\EMInstall.ini" Global $Ignore = IniRead($INI, "Settings", "IGNORE_ERRORS", "") Global $Installer=IniRead($INI,"Settings","Installer","") Run(@COMSPEC & '$INSTALLER /v "$Ignore"',@SCRIPTDIR,@SW_HIDE) Link to comment Share on other sites More sharing options...
Varian Posted January 25, 2011 Share Posted January 25, 2011 Run(@ComSpec & ' /c ' & $INSTALLER & ' /v " ' & $Ignore & '=1"', @ScriptDir, @SW_HIDE) Link to comment Share on other sites More sharing options...
MHz Posted January 26, 2011 Share Posted January 26, 2011 Hi rahuroy. Welcome to the forum. I hope that I have not complicated your code with modifications but I also considered extending it as showing possible options by example. The value obtained for $Ignore and the syntax used in Run() should take your primary focus and the rest can be disregarded as suitable. This code has not been tested so do test it first. Global $Ignore, $Ini, $Installer, $Pid ; Ini Settings file $Ini = @ScriptDir & "\EMInstall.ini" ; Read Ini Setting: IGNORE_ERRORS=0 or IGNORE_ERRORS=1 $Ignore = 'IGNORE_ERRORS=' & IniRead($Ini, "Settings", "IGNORE_ERRORS", 0) ; Read Ini Setting: Installer to run later $Installer = IniRead($Ini, "Settings", "Installer", "") ; If $Installer is something and $Installer exists, then run it. If $Installer And FileExists($Installer) Then $Pid = Run('"' & @ComSpec & '" /c "' & $Installer & '" /v "' & $Ignore & '"', @ScriptDir, @SW_HIDE) ; Check if @error is set. (Use of Exit is optional as used for example) If @error Then Exit 1 ; Wait for process to close ProcessWaitClose($Pid) Else ; Act on condition failure of $Installer If Not $Installer Then Exit 2 If Not FileExists($Installer) Then Exit 3 EndIf The Ini file looks critical so a FileExists() on that may seem good to add. Choices for you to consider. Link to comment Share on other sites More sharing options...
rahuroy Posted January 26, 2011 Author Share Posted January 26, 2011 Run(@ComSpec & ' /c ' & $INSTALLER & ' /v " ' & $Ignore & '=1"', @ScriptDir, @SW_HIDE) Hi Varian , You rock..Thanks for help. Install.ini [settings] IGNORE_ERRORS=1 Installer=sudhi.exe $Ini = @ScriptDir & "\EMInstall.ini" Global $Ignore = IniRead($INI, "Settings", "IGNORE_ERRORS", "") Global $Installer=IniRead($INI,"Settings","Installer","") Run(@ComSpec & ' /c ' & $INSTALLER & ' /v"$Ignore", @ScriptDir, @SW_HIDE) Giving me error... When i run exe through cmd line as sudhi.exe /v"IGNORE_ERRORS=1" runs fine..Please let me what went wrong in the above run command.Thanks alot Link to comment Share on other sites More sharing options...
Varian Posted January 26, 2011 Share Posted January 26, 2011 Hi Varian , You rock..Thanks for help. Install.ini [settings] IGNORE_ERRORS=1 Installer=sudhi.exe $Ini = @ScriptDir & "\EMInstall.ini" Global $Ignore = IniRead($INI, "Settings", "IGNORE_ERRORS", "") Global $Installer=IniRead($INI,"Settings","Installer","") Run(@ComSpec & ' /c ' & $INSTALLER & ' /v"$Ignore", @ScriptDir, @SW_HIDE) Giving me error... When i run exe through cmd line as sudhi.exe /v"IGNORE_ERRORS=1" runs fine..Please let me what went wrong in the above run command.Thanks alot You are not closing your string...in your last post, this part' /v"$Ignore",starts with ', and should end with ' before you start using a variable($Ignore)...you would also need to place an & between the string close and any variable, unless you wanted to literally pass $Ignore as part of the string(not its' value). Since your INI file has =1 already in it, try this $Ini = @ScriptDir & "\EMInstall.ini" Global $Ignore = IniRead($INI, "Settings", "IGNORE_ERRORS", "") Global $Installer=IniRead($INI,"Settings","Installer","") $sCommand = $INSTALLER & ' /v "' & $Ignore & '"' ;Make command line MsgBox(262208, 'Command being sent', $sCommand) ;display command line for testing purposes Run(@ComSpec & ' /c ' & $sCommand, @ScriptDir, @SW_HIDE) ;run command line Link to comment Share on other sites More sharing options...
rahuroy Posted February 16, 2011 Author Share Posted February 16, 2011 Ton of thanks Varian and MHz ..You people rock Link to comment Share on other sites More sharing options...
ckant8 Posted January 25, 2012 Share Posted January 25, 2012 Hi Varian,I executed the above code mentioned above. but the installation is not started.$Ini=@ScriptDir&"EMInstall.ini"Global$Ignore=IniRead($INI,"Settings","IGNORE_ERRORS","")Global$Installer=IniRead($INI,"Settings","Installer","")$sCommand=$INSTALLER&' /v "'&$Ignore&'"';Make command lineMsgBox(262208,'Command being sent',$sCommand);display command line for testing purposesRun(@ComSpec&' /c '&$sCommand,@ScriptDir,@SW_HIDE);run command line Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now