0

I have created a Desktop Application which basically does some scan in the user's computer. I have created the setup using the NSIS. Everything works fine.

Even the Un-installation part works fine. However out of curiosity I wanted to add a feature during the Un-Installation part. I want that once the user uninstalls the application. The application and its files should be removed from the user's pc(that part I have completed). Next thing I want to do is that the user should be redirected to my website stating a message thanking him for using the Application.

For this I have created a batch file which have the website url as well as the User's name in the query string(which he gives during the registration). And I'm creating the batch file using C#.

How do run the batch file during the Uninstallation so that it can get me to the website.

The example url is as follows www.application.com\username='abc'

I tried to get help from this URL but couldnt solve my problem.

Any help would be appreciated.

Thanks and Regards

S. Vikneshwar

Community
  • 1
  • 1
Vikneshwar
  • 1,029
  • 4
  • 20
  • 38
  • It would help if you show us the batch file code and how you execute it in NSIS... – Anders Jan 07 '14 at 07:27
  • The batch file contains nothing but the url which needs to run during the un installation process. It contains @echo off start http://mywebsite.com/deactivation/user_verify.php?username='12345' – Vikneshwar Jan 07 '14 at 08:02
  • Apart from that there is nothing in the Batch file. – Vikneshwar Jan 07 '14 at 08:04
  • `start http://example.com` should work but so should ExecShell, using a batch file is just extra work... – Anders Jan 07 '14 at 08:18
  • @Anders I wrote ExecShell "cmd.exe" "$INSTDIR\test.bat" in the Uninstall part but somehow its not working. – Vikneshwar Jan 07 '14 at 09:33
  • I use that batch file as i need the User's name that i can only get after he/she installs it. – Vikneshwar Jan 07 '14 at 09:34
  • Do you mean %username%? For ExecShell, the first parameter should be "" – Anders Jan 07 '14 at 18:59
  • The whole thing can be sufficed as, I have to open a web page during the uninstallation of the application. I want to open a url based on the user name. And it has to be included during the Uninstallation part. – Vikneshwar Jan 08 '14 at 10:45

2 Answers2

1

Finally after spending few minutes myself I finally completed the process.

I created a batch file using C#. The batch file consisted of the lines

@echo off start http://application.com\username='abc' @echo off

Now I needed to run this batch file during the Uninstallation process.

So I tried using ExecShell, then Exec finaly ended up using ExecWait

The following is the code

Section "Uninstall"

ExecWait '"$INSTDIR\test.bat"'

;some code

SectionEnd

Hope this was useful.

Thanks

Vikneshwar
  • 1,029
  • 4
  • 20
  • 38
  • Using a batch file for this is silly, both start and ExecShell use ShellExecute internally. You can expand %username% in NSIS if you need to. – Anders Jan 09 '14 at 02:28
0

You do not need to use a batch file to open a URL, just use ExecShell...

Anders
  • 97,548
  • 12
  • 110
  • 164