我想为专为 x64 Windows 10 设计的应用程序编写安装程序。我已在 Inno Setup Script 中定义:
[Setup]
MinVersion=10.0.14393
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
AlwaysRestart=yes
我还希望在安装过程中,在 Windows 注册表中启用长路径。我添加了以下代码:
[Registry]
Root: HKLM64; Subkey: "System\CurrentcontrolSet\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify
Root: HKLM64; Subkey: "System\ControlSet001\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify
当我在个人计算机上运行安装程序并重新启动时,注册表项会更改,但当我的同事运行安装程序并重新启动时,注册表项不会更改。该应用程序本身可以在我们的两台计算机上运行。我们都有 x64 Windows 10 系统和管理员权限。该脚本在某些计算机上失败的原因可能是什么?
计算机的日志文件内容,其中条目未更改:
2019-10-09 09:44:41.296 Key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296 Value name: LongPathsEnabled
2019-10-09 09:44:41.296 Setting permissions on key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296 Starting 64-bit helper process.
2019-10-09 09:44:41.328 Helper process PID: 3248
2019-10-09 09:44:41.343 Creating or opening the key.
2019-10-09 09:44:41.343 Successfully created the key.
2019-10-09 09:44:41.343 -- Registry entry --
2019-10-09 09:44:41.343 Key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343 Value name: LongPathsEnabled
2019-10-09 09:44:41.343 Setting permissions on key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343 Creating or opening the key.
2019-10-09 09:44:41.343 Successfully created the key.
最佳答案
只需删除 createvalueifdoesntexist
flag .
这就是导致问题的原因,而您一开始就不希望出现这种情况。
关于registry - 无法通过 Inno Setup Installer 更改注册表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58291967/