Jump to content

Setup.exe


Recommended Posts

I have a script that executes a windows setup.exe file. This setup.exe runs fine if it is in the same folder as the autoit script. However when I have the setup.exe in a different folder I get the error "Please go to the control panel to install and configure components".

From what i have read on the net this is due to the autorun.inf files on the root drive. I get this error even when I hard code the complete path to the setup.exe. I have checked the root drive and do not find any autorun.inf files as I am running the script on a clean virtual machine. If I find the setup file(Windows NT setup Executable )in the C:\WINDOWS\system32 and try and run it I get the same error so I believe this is the setup exe that my script attempts to run. can anyone explain why this is happening and how to ensure the proper exex is run.

here is the code concerning this

$DirPath = @DesktopDir & "\Install" ; Install Folder to be created on the desktop contains the install files

$InstallFolder = @DocumentsCommonDir & "\Results" & "\Install" ;Install results Folder Containing ScreenShots Ect.

If FileExists($DirPath) Then ;check the install folder exists

;check the installation msi file exists

If FileExists($DirPath & "\" & "Setup.exe") Then

;Set path for the install Log

Local $InstallEvent_File_Path = $InstallFolder & "\" & "Installation.log"

; create a log file in the Results/install folder

_FileCreate($InstallEvent_File_Path)

; Write inital info to log

If FileExists($InstallEvent_File_Path) Then ; Check we have created the install log file before writing to it

_FileWriteLog($InstallEvent_File_Path, "Installation Script Start Time" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Computer Name =" & @TAB & @ComputerName & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "OS_Version =" & @TAB & @OSVersion & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Archatechture =" & @TAB & @OSArch & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Service Pack =" & @TAB & @OSServicePack & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "IP Address = " & @TAB & @IPAddress1 & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "CPU Arcatechture = " & @TAB & @CPUArch & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "DNS Domain = " & @TAB & @LogonDNSDomain & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Logon Domain = " & @TAB & @LogonDomain & @CRLF)

FileWriteLine($InstallEvent_File_Path, "" & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Logon Server = " & @TAB & @LogonServer & @CRLF)

FileWriteLine($InstallEvent_File_Path, "Initial Info End Preparing to Launch MSI.EXE" & @CRLF & @CRLF)

EndIf

Run("Setup.exe", $DirPath, @SW_MAXIMIZE)

Link to comment
Share on other sites

have looked further into this and have found a workaround but why it works and just dosent run the normal way I am not sure.

I have found if you set the path as a variable it will run the proper setup file

$FiletoRun = $DirPath & "\" & "Setup.exe"

Run($FiletoRun)

can anyone explain this or what i have done wrong

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

not sure I understand you i have the directory on my destop and use

$DirPath = @DesktopDir & "\Install"

the setup exe is in the install folder if I add a msgbox to print out the $DirPath variable it is the correct path to the setup that i am trying to run, I also have an MSI exe in the same folder and can run it without any problems. Can you expand on what you are explaining to me.

many thanks

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

I believe it should have worked as i said an msi exe in the same folder can be run with the Run command but it has problems with Setup.exe

the install folder containing the setup exe is on the desktop so @DesktopDir & "\Install" provides the proper path. This maybe a bug with Autoit but i cant be sure

Link to comment
Share on other sites

I believe it should have worked as i said an msi exe in the same folder can be run with the Run command but it has problems with Setup.exe

the install folder containing the setup exe is on the desktop so @DesktopDir & "\Install" provides the proper path. This maybe a bug with Autoit but i cant be sure

Oh come on, don't you see the difference with:

MsgBox(0, "", "Setup.exe")

and

MsgBox(0, "", $DirPath & "\" & "Setup.exe")

??

I think MvGulik is right in that you're confused with the working directory.

To sum it up: Give Run() a full path.

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...