Jump to content

What's wrong with my script?


breedja
 Share

Recommended Posts

I'm a bit of a beginner...

I keep getting an error (Unable to execute the external program) when I run my script. The files and directories exist and I can run from a command line. The problem is with this line...Run("msiexec /i c:\temp\ExpressImageInstall\expressimagesetup.msi /qb+")

DirCreate("c:\temp\ExpressImageInstall")

FileCopy("\\ExpressImageInstall\*.*","c:\temp\ExpressImageInstall")

RunAsSet("Administrator", @Computername, "xxxxxxxx")

Run("msiexec /i c:\temp\ExpressImageInstall\expressimagesetup.msi /qb+")

; Reset user's permissions

RunAsSet()

Also, can anyone recommend any reference material for scripting? Many thanks.

Link to comment
Share on other sites

Run("msiexec /i c:\temp\ExpressImageInstall\expressimagesetup.msi /qb+")

Try (not tested):

RunWait("msiexec /i /qb+ c:\temp\ExpressImageInstall\expressimagesetup.msi")oÝ÷ Ù±!?Ûjëh×6DirCreate("c:\temp\ExpressImageInstall")
FileCopy("\\ExpressImageInstall\*.*","c:\temp\ExpressImageInstall\")
IF Not FileExists("c:\temp\ExpressImageInstall\expressimagesetup.msi") Then
  MsgBox(0,'Error', 'MSI file not found!')
  Exit
EndIf
RunAsSet("Administrator", @Computername, "xxxxxxxx")
RunWait("msiexec /i /qb+ c:\temp\ExpressImageInstall\expressimagesetup.msi")
RunAsSet()

Note: added \ in FileCopy and FileExists()

Edited by Zedna
Link to comment
Share on other sites

Zedna, I got the same error..

Unable to execute the external program.:

RunWait("msiexec /i /qb+ c:\temp\ExpressImageInstall\expressimagesetup.msi")

The directory name is invalid.

Try some testing:

#Include <File.au3>
#Include <Array.au3>

DirCreate("c:\temp\ExpressImageInstall")
FileCopy("\\ExpressImageInstall\*.*","c:\temp\ExpressImageInstall\")

ShowMSI('\\ExpressImageInstall\')
ShowMSI('c:\temp\ExpressImageInstall\')

Func ShowMSI($dir)
    $FileList=_FileListToArray($dir,"*.msi",1)
    If @Error Then Return

    _ArraySort($FileList,0,1)
    $tmp = ''
    For $i = 1 to UBound($FileList) - 1
        $tmp &= $FileList[$i] & @crlf
    Next
    MsgBox(0,'Info: ' & $dir, $tmp)
EndFunc

Also check if msiexex is somewhere in PATH

Link to comment
Share on other sites

From the helpfile:

6. Why can I only use Run() to execute .exe files? What about .msi / .txt and others?

Only a few file extensions are usually "runable" - these are .exe, .bat, .com, .pif. Other file types like .txt and .msi are actually executed with another program. When you double click on a "myfile.msi" file what actually happens in the background is that "msiexec.exe myfile.msi" is executed. So to run a .msi file from AutoIt you would do:

RunWait("msiexec myfile.msi")

Or, an even simpler way is to run the command "start" which will automatically work out how to execute the file for you:

RunWait(@COMSPEC & " /c Start myfile.msi")

Back To Top

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...