码上敲享录 > java常见报错解答 > inno setup 打包exe程序开机自启

inno setup 打包exe程序开机自启

上一章章节目录下一章 2019-05-21已有2198人阅读 评论(0)

用inno setup打包工具打包生成的exe文件没有开机启动设置,我们要修改.iss文件,有两种方式可以实现开机启动。

方法一:

有一种不写注册表的方法,其实就是将快捷方式添加到“启动”文件夹

[Tasks]

Name: "startupicon"; Description: "开机启动"; GroupDescription: "{cm:AdditionalIcons}";


[Icons]

Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


方法二:修改注册表方法 //注册表启动项

[Registry]

Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "testrun"; ValueData: "{app}\{#MyAppExeName}"



其中"{app}{#MyAppExeName}" 中的#MyAppExeName是你的exe程序的名称

下面是我的.iss部分文件

[Languages]

Name: "english"; MessagesFile: "compiler:Default.isl"


[Tasks]

Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode


[Files]

Source: "E:\socket\scoketprint.exe"; DestDir: "{app}"; Flags: ignoreversion

Source: "E:\socket\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files


[Icons]

Name: "{group}\新筛打印"; Filename: "{app}\scoketprint.exe"

Name: "{group}\{cm:ProgramOnTheWeb,新筛打印}"; Filename: "http://www.example.com/"

Name: "{group}\{cm:UninstallProgram,新筛打印}"; Filename: "{uninstallexe}"

Name: "{autodesktop}\新筛打印"; Filename: "{app}\scoketprint.exe"; Tasks: desktopicon

Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\新筛打印"; Filename: "{app}\scoketprint.exe"; Tasks: quicklaunchicon


[Registry]

Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "testrun"; ValueData: "{app}\scoketprint.exe"


[Run]

Filename: "{app}\scoketprint.exe"; Description: "{cm:LaunchProgram,新筛打印}"; Flags: nowait postinstall skipifsilent



0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交