dwhaley666
Posts: 7
Joined: Wed Mar 04, 2009 3:49 pm

EXE Location

How can I determine the folder a bootstrapped exe is being run from? I need to store this location in a registry setting.

Thanks
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: EXE Location

Hi,

You can try using the SETUPEXEDIR property. It should contain the location of the EXE bootstrapper.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dwhaley666
Posts: 7
Joined: Wed Mar 04, 2009 3:49 pm

Re: EXE Location

Is it possible to get the Date/Time of the EXE as well?

Thanks
cyb
Posts: 43
Joined: Wed Apr 15, 2009 1:06 pm

Re: EXE Location

Hi,

I am afraid that this is not supported by the bootstrapper. However, you can try using a custom action with a VBScript.
Here are some articles containing the VBScript code you might need:
Retrieving File Properties
Displaying File Information using VBS

Best regards,
cyb
Cosmin Budrica
Advanced Installer Team
http://www.advancedinstaller.com/
dwhaley666
Posts: 7
Joined: Wed Mar 04, 2009 3:49 pm

Re: EXE Location

I am trying to update an ini file with this info, so where and when would I put a script?

And how do I reference it from th inifile editor?

Thanks
cyb
Posts: 43
Joined: Wed Apr 15, 2009 1:06 pm

Re: EXE Location

Hi,

You can follow the next steps:
- create a new Property;
- modify your VBScript to store the information you collect in the Property you have created ;
- add your custom action under the InstallUISequence->Begin ;
- go to Files and Folders and import or create your .INI file ;
- use the Property in your .INI file.
You can follow the guidelines in our INI Files article in order to create and edit your INI.

In order to store data in a Property, you will have to use the syntax:

Code: Select all

Session.Property("Property") = value
where "value" is the data you collect.

Best regards,
cyb
Cosmin Budrica
Advanced Installer Team
http://www.advancedinstaller.com/
dwhaley666
Posts: 7
Joined: Wed Mar 04, 2009 3:49 pm

Re: EXE Location

I don't know what you mean by Create a new property. I can't find anything on this in the help file.

I get the ini side of it, I just need the Bootstrapper Create date to be available from the ini editor.

If you could explain in detail how to get there, I would appreciate it.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: EXE Location

Hi,

You can create an installer property in the Install Parameters page. For example, you could create a property named SETUP_CREATE_DATE which uses the default value. After the property is created, you can try following these steps:
- on the disk create a new text file and rename its extension to .VBS
- use this code in it:

Code: Select all

'get the EXE path
Dim setupPath
setupPath = Session.Property("SETUPEXEDIR")
setupPath = setupPath & "setup.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(setupPath) Then
	Dim f
	Set f = objFSO.GetFile(setupPath)

	'get file information
    Session.Property("SETUP_CREATE_DATE") = CStr(f.DateCreated)
End If
- in the above code replace "setup.exe" with the name of your EXE setup file
- save the file and add it as a "New Attached Custom Action" under "InstallUISequence" -> "Begin" in the Custom Actions page
- in the "Custom Action Properties" pane make sure that the "Function Name" field is empty
- after this custom action runs, the SETUP_CREATE_DATE property will contain the creation date of the EXE
- use this property in your INI

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dwhaley666
Posts: 7
Joined: Wed Mar 04, 2009 3:49 pm

Re: EXE Location

Very nice.

Works perfectly, thanks.

Return to “Common Problems”