简体   繁体   中英

Import .reg registry files silently in Inno Setup

I have a need to run few registry files via Inno Setup within the code. I can not use [Registry] section as this is a standard installation kit which should pick .reg files created and run them.

Exec('regedit.exe', 'C:\Support\MyReg.reg', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)

I want to run this silently so I tried the following.

Exec('regedit.exe', 'C:\Support\MyReg.reg /s', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)

But it does not work. Can anybody tell me what I am missing here?

The /s has to come before the path:

Exec('regedit.exe', '/s C:\Support\MyReg.reg', '', SW_HIDE, ewWaitUntilTerminated, Code);

Though I suggest you better use the command-line registry tool, the reg.exe :

Exec('reg.exe', 'import C:\Support\Banners.reg', '', SW_HIDE, ewWaitUntilTerminated, Code);

If you want execute .reg file in silent on WPI (Windows Post-Installer), add the next command: {REGEDIT} C:/file.reg

Have a nice day

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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