/build/static/layout/Breadcrumb_cap_w.png

Easy way to refer to an MSI and its MST via .bat or .cmd file

The following is more useful when you have and MSI and an MST that are giving you hassle.

Every now and again I need to execute an MSI and an MST from a previously unknown network location - for instance SMS distribution share, Altiris deployment server etc. etc.

Normally I'd need to browse to the network share and manually enter (or drag/drop) in Start/Run:

msiexec /i [long and complicated path]\MyInstall.msi /t [the same long and complicated path]\MyTransform.mst

Instead, I always create this simple bat file and keep it together with the msi/mst:

@Echo Off

msiexec /i "%~dp0MyMsiInstall.msi" TRANSFORMS="%~dp0MyTransform.mst"

Notably:

1. %~dp0 - returns the current path where this very bat file is (and where the msi and the mst files are too...)

2. when you enclose the whole variable/filename in quotation marks (as above), you can have spaces in the path and/or the msi file name without any troubles...

3. there is NO backslash ( \ ) between %~dp0 and the filename afterwards

----

Why do you ever need to run an msi/mst from a network share - for testing purposes of course...

Sometimes because of a failed install or the whole script not executing or the ghastly 'I set the install job 2 hours ago and still no sign of it...'

so, save some time, its precious...


Comments

  • Hi moobear,

    That looks good - will be interested in trying it out to see how it works, the other thing to remember if doing this manually you can call on the transform by using TRANSFORMS="Transfrom.MST" - you don’t need the path as it will automatically look inside the same folder as the MSI

    Kind Regards
    spef
    Hopefully some packaging tips comming to www.spefdata.com - Spef 12 years ago
  • If you are leveraging the install directory for more than just the MSI or are in a batch file, simply use the native OS command "PUSHD %~DP0" at the top of the script to make the scripts current directory the active directory. - dnelson 12 years ago
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ