A problem with batch file
-
22-08-2019 - |
Question
I created a batch file, to uninstall my application. My problem is that as result, this uninstallation deleted some files but kept others.
For example one, I created a folder in C:\\Documents and settings\User-Name\myCompanyName\My Application name\
This folder contains all files for my application. Now when I uninstall, all these files are deleted. But I want to delete "myCompanyName" folder too from "C:\Documents and settings\User-Name"
The other problem tied with the previous one is that I added a new folder to the start menu called myComapny
It holds 4 files:
- exe file
- config file
- help file, and
- uninstall file
When I click on the uninstall file, it removes everything but still keeps the folder in the start-menu containing the four files I just listed.
How could I delete the unwanted folders through the batch file?
Here is my batch file code:
@echo off
msiexec /x {DD75996F-C279-420A-9A19-48EF9EFE70C2}
RD /s "C:\Program Files\ASGATech"
RD /s "C:\Documents and Settings\%userprofile%\start menu\programs\ASGATech"
pause
NOTE: I tried to change the extension of the batch file from bat
to cmd
I also tried to get the current login user %userprofile% to go to his/her start menu. If this way is wrong, please inform me.
Solution
Remove the C:\Documents and Settings - this is already in the %userprofile% tag.
RD /s "%userprofile%\start menu\programs\ASGATech"