简体   繁体   中英

Change the installation path with msi API

I'm trying to set installation path manually, with these lines of code,

MSIHANDLE msiHandle;
UINT openPackageExitCode = MsiOpenPackage(LR"(path to .msi file)", &msiHandle);
LPCTSTR newPath = LR"(C:\test\)";
UINT changePathResult = MsiSetTargetPath(msiHandle, L"INSTALLDIR", newPath);
MsiCloseHandle(msiHandle);

but, I get an error which says ERROR_DIRECTORY .

How can I change the installation path with this method?

调用MsiSetTargetPath定制操作后CostFinalize行动解决我的问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM