我做了使用Inno Setup的一个安装程序,我需要重新启动计算机的某些文件被运行后,所以我用从溶液中这个职位。
创新的安装示例“ CodePrepareToInstall.iss ”可以正常工作,因此我在测试安装中使用了该代码,但计算机重启后无法启动安装程序。
这两个安装程序(inno演示和我的测试)都在“ HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ RunOnce ”中添加了一个注册表项,唯一的区别是增加了价值。我的st声比inno演示中添加的字符串长得多。
注册表/ runonce是否有价值限制?
Inno Demo Value:
"C:\Users\Admin\Documents\Inno Setup Examples Output\setup.exe" /restart=1 /LANG=default /DIR="C:\Program Files (x86)\My Program" /GROUP="My Program"
My Installer Value:
"C:\Users\Admin\Documents\Inno Setup Projekte\Treiber Test\bin\Driver Test Setup.exe" /restart=1 /LANG=german /DIR="C:\Driver" /GROUP="Driver Test Setup" /TYPE="full" /COMPONENTS="1234driverinstaller,audio,bluetooth,chipset,devicepowermanager,gps,inputmanagementservice,modem,lan,1234powerplan,touchscreen,vga,wlan,wwan,1234products"
弄清楚了。Windows从HKLU或HKLM中的RunOnce注册表运行的命令限制为256个字符。
因此,我决定创建一个批处理文件来启动我的安装程序,然后自行删除它。因此,我只需要将批处理的路径传递给RunOnce注册表。
InnoScript:
procedure CreateRunOnceEntry;
var
RunOnceData: String;
begin
RunOnceData := 'echo off' + #13#10;
RunOnceData := RunOnceData + 'start "" ';
RunOnceData := RunOnceData + Quote(ExpandConstant('{srcexe}')) + ' /restart=1';
RunOnceData := AddParam(RunOnceData, 'LANG', ExpandConstant('{language}'));
RunOnceData := AddParam(RunOnceData, 'DIR', Quote(WizardDirValue));
RunOnceData := AddParam(RunOnceData, 'GROUP', Quote(WizardGroupValue));
if WizardNoIcons then
RunOnceData := AddSimpleParam(RunOnceData, 'NOICONS');
RunOnceData := AddParam(RunOnceData, 'TYPE', Quote(WizardSetupType(False)));
RunOnceData := AddParam(RunOnceData, 'COMPONENTS', Quote(WizardSelectedComponents(False)));
RunOnceData := AddParam(RunOnceData, 'TASKS', Quote(WizardSelectedTasks(False)));
RunOnceData := RunOnceData + #13#10 + 'start /b cmd.exe /c del %0' + #13#10 + 'exit';
SaveStringToFile(ExpandConstant('{commonappdata}\StartInstallation.cmd'), RunOnceData, True);
if not IsWin64 then
RegWriteStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\RunOnce', RunOnceName, ExpandConstant('{commonappdata}\StartInstallation.cmd'));
if IsWin64 then
RegWriteStringValue(HKLM, 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce', RunOnceName, ExpandConstant('{commonappdata}\StartInstallation.cmd'));
end;
批处理文件:
echo off
start "" "C:\Users\Admin\Documents\Inno Setup Projekte\Treiber Test\bin\Driver Test Setup.exe" /restart=1 /LANG=german /DIR="C:\Driver" /GROUP="Driver Test Setup" /TYPE="full" /COMPONENTS="1234driverinstaller,audio,bluetooth,chipset,devicepowermanager,gps,inputmanagementservice,modem,lan,1234powerplan,touchscreen,vga,wlan,wwan,1234products"
start /b cmd.exe /c del %0
exit
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句