2013-06-18 103 views
1

我使用WiX的最新版本,以建立自己的安裝程序項目,需要一個解決我的問題的一部分...MSI複製到一個目錄中安裝

當我安裝ProductA.msi,我想要ProductA.msi將自己複製到一個目錄中,將其稱爲%PROGRAMFILES%\ ProductA \ Installer - 以便我使用的安裝程序可在處重新使用%PROGRAMFILES%\ ProductA \ Installer \ ProductA.msi

有誰知道這是可能的嗎?

+2

您知道msiexec已經緩存了安裝程序,不是嗎? –

+2

Windows Installer通常在%windir%\ Installer中保留所有安裝程序的副本。請參閱http://superuser.com/questions/473569/where-does-windows-store-msi-files-for-uninstallation上的答案以找到您的安裝程序。 – sttaq

+1

@sttaq - 不應該需要*定位*安裝程序 - 有一個原因,爲什麼'msiexec'接受軟件包ID作爲替代'.msi'的路徑。 –

回答

1

我不確定你喜歡做什麼是好的。

但是: 您可以使用robocopy編寫一個.bat文件,將msi及其文件複製到目標並在之後啓動.msi。

0

我需要做同樣的事情,並最終拋出PowerShell腳本作爲自定義操作。 WiX具有指向正在運行的.msi的[OriginalDatabase]屬性。我只是將它作爲一個參數傳遞給一個快速腳本,它可以工作。

param(
[string]$MsiLocation 
) 

echo "Creating directory" 
md -Force "C:\directory" 

echo "Removing current files" 
rm "C:\directory\*" 

echo "Copying in new .msi" 
cp "$MsiLocation" "C:\directory\" 

這不是優雅的,但它可以完成工作。有關更多詳細信息,請參見this answer

相關問題