Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8468527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:57:37+00:00 2026-06-10T15:57:37+00:00

I create an installer using NSIS and the code given below. The installer is

  • 0

I create an installer using NSIS and the code given below. The installer is created successfully created but when i install the program in pc uninstaller is not created during first insatllation but when i install it again, Uninstaller is created successfully> What can i do plz help…
My nsi script:

# declare name of installer file

!define PRODUCT_NAME "NepHotel"

Name "NepHotel"
outfile "NepHotel_setup.exe"
InstallDir $PROGRAMFILES\NepHotel


RequestExecutionLevel user

Page directory
Page instfiles

# open section
section ""


CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" ""

;create start-menu items
CreateDirectory "$SMPROGRAMS\NepHotel"
CreateShortCut "$SMPROGRAMS\NepHotel\${PRODUCT_NAME}.lnk"          "$INSTDIR\${PRODUCT_NAME}.exe" "" "$INSTDIR\${PRODUCT_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\NepHotel\Readme.lnk" "$INSTDIR\user.props" "" "$INSTDIR\user.props" 0
CreateShortCut "$SMPROGRAMS\NepHotel\uninstall.lnk" "$INSTDIR\uninstall.exe" 1


;write uninstall information to the registry
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
             "DisplayName" "${PRODUCT_NAME}"
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
             "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""


  WriteUninstaller "$INSTDIR\Uninstall.exe"



SetOutPath $INSTDIR
File NepHotel.exe
File user.props


# end the section
sectionEnd


;Uninstaller Section  
Section "Uninstall"

;Delete Files 
  RMDir /r "$INSTDIR\*.*"    

;Remove the installation directory
  RMDir "$INSTDIR"

;Delete Start Menu Shortcuts
  Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
  RmDir  "$SMPROGRAMS\${PRODUCT_NAME}"

;Delete Uninstaller And Unistall Registry Entries
 enter code here DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_NAME}"
  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall    \${PRODUCT_NAME}"  

SectionEnd

Function .onInstSuccess
  MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. Use the desktop icon to     start the program."
FunctionEnd
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:57:39+00:00Added an answer on June 10, 2026 at 3:57 pm

    Put SetOutPath $INSTDIR before the call to WriteUninstaller.

    You cannot use RequestExecutionLevel user and then install to $Programfiles/HKLM, you need to request administrator rights:

    Outfile RequireAdmin.exe
    
    ; BEGIN 8< 8< 8< 8< 8< 8< 8< 8<
    
    RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
    
    !include LogicLib.nsh
    
    Function .onInit
    UserInfo::GetAccountType
    pop $0
    ${If} $0 != "admin" ;Require admin rights on NT4+
        MessageBox mb_iconstop "Administrator rights required!"
        SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
        Quit
    ${EndIf}
    FunctionEnd
    
    ; END >8 >8 >8 >8 >8 >8 >8 >8
    
    Page InstFiles
    
    Section
    SectionEnd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using an NSIS script to create an installer for my Java program.
I am using wix to create installer. I am using below code in Product.
I'm using Inno Setup to create an installer for my program but I want
I'm using NSIS to create an installer for a program, what is the best
I'm using NSIS to create an installer which will install files from a web
Is it possible to create invisible form fields in an NSIS installer? I'm using
I'm using Wix to create an installer for a Silverlight application. When I install
I am using NSIS to create my installers/uninstallers, and the uninstaller seems to have
When I create a Windows Installer package (say using WiX) and I install the
I'm trying to create a post install configuration page in my nsis script using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.