P.Martin
P.Martin

Reputation: 21

Launch a .reg file from NSIS

I would like to know how to launch a .reg file using NSIS.

this file looks like this:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching] "SearchOrderConfig"=dword:00000003

thanks in advance! Bye

Upvotes: 2

Views: 1114

Answers (1)

Anders
Anders

Reputation: 101559

WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" "SearchOrderConfig" 0x00000003 

There are two things issues you need to deal with for this to work:

  1. Only administrators can write to HKLM so you need to add RequestExecutionLevel admin to your script.

  2. On 64-bit versions of Windows this is going to write to the 32-bit view of the registry so you probably want to call SetRegView 64 before WriteRegDWORD.

It can be helpful to use Process Monitor to see why a registry write fails and to verify that you are writing to the correct place.

Upvotes: 1

Related Questions