rahuroy 0 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) Share this post Link to post Share on other sites
Varian 8 Posted January 25, 2011 Run(@ComSpec & ' /c ' & $INSTALLER & ' /v " ' & $Ignore & '=1"', @ScriptDir, @SW_HIDE) Share this post Link to post Share on other sites
MHz 80 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. Share this post Link to post Share on other sites
rahuroy 0 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 Share this post Link to post Share on other sites
Varian 8 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 Share this post Link to post Share on other sites
rahuroy 0 Posted February 16, 2011 Ton of thanks Varian and MHz ..You people rock Share this post Link to post Share on other sites
ckant8 0 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 Share this post Link to post Share on other sites