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:
msiexec /i "%~dp0MyMsiInstall.msi" TRANSFORMS="%~dp0MyTransform.mst"
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...