Sign in to follow this  
Followers 0
breedja

What's wrong with my script?

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

How about specifying working directory.

RunWait("msiexec /i c:\temp\ExpressImageInstall\expressimagesetup.msi /qb+","c:\temp\ExpressImageInstsall")
Edited by Joon

Share this post


Link to post
Share on other sites

I'm checking out some other posts...thanks again.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I see nothing wrong with the Run in the OP, but there is always ShellExecute.


[size="1"][font="Arial"].[u].[/u][/font][/size]

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