1
votes

If we are using this in custom action of an MSI, then WScript.ScriptName or WScript itself won't work.

The below will give the execution location (i.e., msiexec.exe) but not the VBScript or MSI file location.

Set WshShell = CreateObject("WScript.Shell")
strCurDir    = WshShell.CurrentDirectory

We can use below one to get the script location but it will work only in Immediate Execution but not in Deferred.

cdsd = Session.Property("SourceDir")

Please let me know if any other alternative to use in MSI Custom Actions, specially for deferred.

1

1 Answers

0
votes

Hope this helps! maybe? I can't tell if vbscript was or was not your intended usage.

SrcDirLen=Len(wscript.ScriptFullName)-Len(wscript.ScriptName)-1
SourceDir=Left(wscript.ScriptFullName, SrcDirLen)

I think this answer might be what you're looking for however.

SourceDir = Session.Property("SETUPEXEDIR") 'credit to link below

How to find the setup location in an VBScript custom action for InstallShield?

after edits... I got nothing else man... Sorry, the MSI is a little out of my element. =) I tried.