Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th June 2009, 06:50   #1
jairainbow
Junior Member
 
Join Date: Feb 2008
Posts: 18
uninstall before install (both are silent) and executing batch file silently

Hi,
I want to uninstall the previous version of my product while installing it. From example I added the following code in Function .onInit

Function .onInit
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
ExecWait "$R0"
done:
FunctionEnd

And my install and uninstall are silent.

Problem: 1. uninstall and install are happing at same time so files created using install are removed while uninstalling.
So some folders and files are missing once installation is completed. Please help me how to handle this?

2. One more query.... I am executing some batch files using EXECWAIT command while installing and uninstalling. Even though i made the installer silent, while executing bat file black screen is popped up. How to execute the batch file silently?
jairainbow is offline   Reply With Quote
Old 18th June 2009, 07:59   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
See:

http://nsis.sourceforge.net/When_I_u...he_uninstaller

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th June 2009, 10:41   #3
jairainbow
Junior Member
 
Join Date: Feb 2008
Posts: 18
i used ExecWait '"$INSTDIR\uninstall.exe" _?=$INSTDIR'...i am using the same location for installing and uninstalling.
the uninstall is not happaning instead installation completed sucessfully. all new file a folder are created under one fo the exsisting directory .
jairainbow is offline   Reply With Quote
Old 18th June 2009, 11:37   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Don't use $INSTDIR. Use the value you read from the registry to make sure it's the right one.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th June 2009, 12:24   #5
jairainbow
Junior Member
 
Join Date: Feb 2008
Posts: 18
Yes it is installing ...but installed location is having the problem now
I used InstallDir "$PROGRAMFILES\MyPro"
first time it is installing correctly in C:\Program Files\MyPro but the second time (i.e. uninstalling and installing) the product is installed in one of the directory previously installed.

First Time installing my product directory structure
C:\Program Files\MyPro
--aaa
--bbb
--ccc
--uninst.exe
--readme.html
Second time
C:\Program Files\MyPro
--aaa
--aaa
--bbb
--ccc
--uninst.exe
--readme.html
--uninst.exe (first product uninstall exe).how to install correctly in specified location and delete old product uninst.exe?

How to dynamically change the install directory which is set by InstallDir "$PROGRAMFILES\MyPro". Install script behave like this in general if specified InstallDir is having data then it will search for empty directory inside that and install. How to change this behavior?
jairainbow is offline   Reply With Quote
Old 18th June 2009, 13:48   #6
jairainbow
Junior Member
 
Join Date: Feb 2008
Posts: 18
i tried using this function

Function .onVerifyInstDir
StrCpy $INSTDIR "$PROGRAMFILES\CSCT"
FunctionEnd


but this also dosen't work then i copied 'StrCpy $INSTDIR "$PROGRAMFILES\CSCT" 'this line inside Section "MainSection" SEC01....now it is working fine..
is this correct way....
jairainbow is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump