how to write nsi script for a windows application custom URL schema setup

Dineshkumar.S 446 Reputation points
2023-06-06T12:21:04.2733333+00:00

I want to add a new registry for my Windows application while installing so for that I need to add the registry in the nsi script so can anyone suggest to me how to write that in nsi script, Thanks in advance.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,383 questions
{count} votes

Accepted answer
  1. Bukke SanthiSwaroop Naik 385 Reputation points
    2023-06-06T15:05:44.1833333+00:00
    To add a new registry entry during the installation of your Windows application using NSIS (Nullsoft Scriptable Install System), you can follow these steps:
    
    Open your NSIS script file (usually with a .nsi extension) in a text editor.
    
    Locate the section in the script where the installation process is defined. This is typically the "Section" section.
    
    Inside the "Section" section, you can add a new registry entry using the WriteRegStr, WriteRegDWORD, or other registry-related NSIS commands depending on the type of registry entry you want to create. Here's an example:
    
    nsis
    Copy code
    Section "MyApplication"
      SetOutPath "$INSTDIR" ; Set the installation directory
    
      ; Add a new registry entry
      WriteRegStr HKLM "Software\MyCompany\MyApplication" "MySetting" "MyValue"
    
      ; ... Other installation commands
    
    SectionEnd
    In the example above, the WriteRegStr command is used to create a new string value in the HKEY_LOCAL_MACHINE\Software\MyCompany\MyApplication registry key. Replace "MyCompany", "MyApplication", "MySetting", and "MyValue" with your desired values.
    
    Save the NSIS script file.
    
    Build or compile your NSIS script using the NSIS compiler. This will generate an executable installer for your application that includes the registry entry.
    
    When the installer is executed, it will create the specified registry entry during the installation process. Make sure to run the installer with administrative privileges to ensure the necessary permissions for modifying the registry.
    
    0 comments No comments

0 additional answers

Sort by: Most helpful