ladiesman1792
ladiesman1792

Reputation: 283

Get Installation Folder Path string in VB2010 Setup Project

How can I get the installation folder path and put in a variable using VBScript?

enter image description here

My VBScript put files to certain folders and I want to do it dynamically.

Upvotes: 0

Views: 127

Answers (2)

ladiesman1792
ladiesman1792

Reputation: 283

I did an alternative to this problem. I used Shell.BrowseForFolder method to browse for a folder and returned its path:

function fnShellBrowseForFolderVB()
        dim objShell
        dim ssfWINDOWS
        dim objFolder

        ssfWINDOWS = 36
        set objShell = CreateObject("shell.application")
            set objFolder = objShell.BrowseForFolder(0, "Example", 0, ssfWINDOWS)
                if (not objFolder is nothing) then
                    'Add code here.
                end if
            set objFolder = nothing
        set objShell = nothing
    end function

Source: http://msdn.microsoft.com/en-us/library/windows/desktop/bb774065(v=vs.85).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

Hope this helps everyone.

Upvotes: 0

PhilDW
PhilDW

Reputation: 20780

The answer is that you can't because Visual Studio setups don't have that capability. All custom actions, vbscripts, C++, C# or whatever all run after the files have been installed. There is no capability to run code before or during that UI sequence. If you want to get the location from somewhere on the system, setup projects have a search that might work to get the default value.

Upvotes: 1

Related Questions