Jump to content
Ketarin forum

Install issues with MSI on relative path

Guest Peter L.

Recommended Posts

Guest Peter L.


I'm new to Ketarin and currently try to get going with a portable setup.

My file structure is like

I've configured Setup files to be downloaded to "..\InstallDir1\" and "..\InstallDir2\", which works correctly.

When running the installers, the {file} variable is "drive:\ketarin\..\InstallDir1\Installer1.exe" and "drive:\ketarin..\InstallDir2\Installer2.msi".
For EXE installers this does not seem to be an issue, for MSIEXEC it is.
Msiexec.exe reports file not found errors.

Is there a way to work around this? E.g. get the relative path expanded to the absolute path before feeding to msiexec?



Link to comment
Share on other sites

Welcome, Peter!

There is some great documentation for Ketarin on the Wiki

What you're looking for is either {root} or {startuppath}, depending on how you want to write your scripts. The final strings would be something like "{root}\ketarin\..\InstallDir1\Installer1.exe" and "{startuppath}\..\InstallDir2\Installer2.msi", or, for msiexec:

msiexec /q /nr "{startuppath}\..\InstallDir2\Installer2.msi"

HOWEVER, you may find that a better solution (especially if you're creating a portable drive) is to remap it to the drive letter it's expecting. Pick a high drive letter and you can prep the drive with powershell using something like this:

Get-Partition -DriveLetter ($pwd.path.substring(0,1)) | Set-Partition -NewDriveLetter K

Run this (elevated) as part of your initial startup routine and you can be a lot more lenient with the drive letters using K: as the Ketarin drive. Of course, don't run this from a script on C:. :)

Link to comment
Share on other sites

Hi Shawn,

I've already read through the wiki, thanks for the hint.

The problem is that

msiexec /q /nr "{startuppath}\..\InstallDir2\Installer2.msi"

does not fly, at least not on the Windows 10 Pro (1909) computer I was testing on.

"..\" does not get interpreted as "one directory above the current one" but leads to a "file not found" error with msiexec.

In the end it doesn't matter if I use the {startuppath} or the {file} variable as the final string still contains '..\'


Batch scripting this would need some jumping through hoops and Powershell is not the tool of my choice (I'm not reluctant to learning, it's just too Microsoftish in many ways ...).

I did some testing with custom install scripts but stopped when "%~dp0" did not expand to the current path in my batch script (I know that envvar %CD% would do the same in this case).

Maybe I'll be doing some more testing and report back with what I've found out.





Edit 1

I've checked if I could work around the issue with a custom setup batch script.

The problem with that is, that depending on how the Ketarin executable is started the path changes (e.g via Script from the parent directory or manually from the Ketarin subdirectory).

Depending on the point of view, the problem is either Windows Installer not supporting relative paths (I've found a post where someone from MS confirms this  https://www.pcreview.co.uk/threads/problem-with-msiexec-and-relative-path.1544499/) or Ketarin not expanding the path when building the variables.

I guess the {file} variable gets concatenated from {startuppath} and the path configured for the download location in a string operation.

I've tried modifying the {file} variable with "regexreplace" which does not seem to work in the "Start process" context of setup instructions (me being stupid might also be the reason for this).



Edit 2

"Me being stupid" seems to be the issue ...

I've worked around the issue with the following solution:


In the Setup section I've set the action to "Start process ..." with following paramters.

Program to start: msiexec.exe

Arguments: /i {file:replace:\Ketarin\..\:} /qn /norestart


This does exactly what the relative path should be doing, it removes the Ketarin program directory and also the "..\" makro from the string.




Link to comment
Share on other sites

  • 2 weeks later...

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

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.