0

I am building a setup using NSIS. In my setup, i need to delete a folder (and its contents) in the windows %appdata% (or %programdata% in win7) on uninstallation of my application.

As i am relatively new to NSIS, Kindly Requesting you for a Function or a piece of script that i can use in my setup to execute this operation.

Seki
  • 11,135
  • 7
  • 46
  • 70
Bomzinho
  • 161
  • 1
  • 7
  • 14

1 Answers1

8

For local user only:

RMDir /r "$APPDATA\YourApp"
RMDir /r "$LOCALAPPDATA\YourApp"

For all users:

SetShellVarContext all
RMDir /r "$APPDATA\YourApp"
RMDir /r "$LOCALAPPDATA\YourApp"
SetShellVarContext current
  • Option /r - required to delete subfolders.
  • Option /REBOOTOK - required for delayed removal (after system restart).

To delete files only use:

Delete   "$APPDATA\YourApp\*.*"
Seki
  • 11,135
  • 7
  • 46
  • 70
Serge Z
  • 425
  • 2
  • 11
  • @Bomzinho: don't forget to [accept the answer](http://meta.stackoverflow.com/a/65088/173356) – Seki Oct 08 '15 at 13:04