脚本 – 用于更改MSI中的操作序列记录的脚本
发布时间:2020-12-13 20:39:38 所属栏目:Windows 来源:网络整理
导读:要解决问题 listed here,我必须在MSI中更改InstallExecuteSequence .RemoveExistingProducts记录. 我想这样做是构建过程的一部分,而不是与Orca混在一起 修改MSI_SetProperty.js脚本给出 // MSI_SetActionSequence.js msi-file table action sequence// Perfo
|
要解决问题
listed here,我必须在MSI中更改InstallExecuteSequence .RemoveExistingProducts记录.
我想这样做是构建过程的一部分,而不是与Orca混在一起
修改MSI_SetProperty.js脚本给出
// MSI_SetActionSequence.js <msi-file> <table> <action> <sequence>
// Performs a post-build fixup of an msi to set the specified table/action/sequence
// Constant values from Windows Installer SDK
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyInsert = 1;
var msiViewModifyUpdate = 2;
var msiViewModifyAssign = 3;
var msiViewModifyReplace = 4;
var msiViewModifyDelete = 6;
if (WScript.Arguments.Length != 4)
{
WScript.StdErr.WriteLine("Usage: " + WScript.ScriptName + " file table action sequence");
WScript.Quit(1);
}
var filespec = WScript.Arguments(0);
var table = WScript.Arguments(1);
var action = WScript.Arguments(2);
var sequence = parseInt(WScript.Arguments(3));
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec,msiOpenDatabaseModeTransact);
WScript.StdOut.WriteLine("Looking for action:" + action);
try
{
var sql = "SELECT Action,Sequence FROM " + table + " WHERE Action = '" + action + "'";
var view = database.OpenView(sql);
view.Execute();
var record = view.Fetch();
if (record)
{
while (record)
{
WScript.StdOut.Write("Found: " + record.StringData(0) + "," + record.StringData(1) + "," + record.StringData(2));
if (record.IntegerData(2) != sequence)
{
WScript.StdOut.WriteLine(" - changing to " + sequence);
record.IntegerData(2) = sequence;
view.Modify(msiViewModifyUpdate,record);
}
else
WScript.StdOut.WriteLine(" - OK");
record = view.Fetch();
}
view.Close();
database.Commit();
}
else
{
view.Close();
throw("Warning - Could not find " + table + "." + action);
}
}
catch(e)
{
WScript.StdErr.WriteLine(e);
WScript.Quit(1);
}
要调用此脚本以执行上述操作序列的更改,您可以将以下内容放在批处理文件中,并从post build事件调用该文件,例如PostBuildEvent = $(ProjectDir)PostBuild.bat cscript.exe MSI_SetActionSequence.js YOURINSTALLER.MSI InstallExecuteSequence RemoveExistingProducts 1525 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows – 如何让我的Delphi 5应用程序显示密码“blob”?
- windows-8 – 增加Win8热角的大小?
- 无法安装Windows 7 SDK(需要已安装的.NET Framework 4)
- Windows上有Node.js的node-waf吗?
- windows-phone-7 – 我应该在Windows Phone 7中使用什么样的
- .net – 如何从Windows窗体应用程序中打开记事本并在其中放
- Windows Azure – 以编程方式创建订阅
- 微信图片解决方法-windows版的dat文件
- 以编程方式将Access(.mdb)文件读入R中,用于Windows和Mac
- 基础知识 一个工具给win7 win10的同学 或者MAC 可以跳过
