繁体   English   中英

Inno Setup:重启过程中重启过程中无法启动

[英]Inno Setup: restart during setup process won't start after reboot

我使用Inno Setup制作了一个安装程序,我需要在运行一些文件后重新启动计算机,所以我使用了这篇文章的解决方案。

inno设置示例' CodePrepareToInstall.iss '工作正常,因此我使用代码进行测试安装,但我的安装程序在计算机重新启动后无法启动。

安装程序(inno演示和我的测试)都在' HKLM \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ RunOnce '中添加了一个注册表项,唯一的区别是增值。 我的刺痛比inno demo中添加的字符串长得多。

注册表/ 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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