Computing.Net > Forums > Programming > RMDIR from an uninstall.bat

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

RMDIR from an uninstall.bat

Reply to Message Icon

Name: ajbufort
Date: June 11, 2004 at 09:49:11 Pacific
OS: XP/2000
CPU/Ram: 1.1GHz
Comment:

Hello,

I have written an application whose uninstaller eventually calls a .BAT file to help uninstall itself, as well as delete the directory the uninstall.exe was sitting in. For some reason, my rmdir command is failing to delete the directory. See code below:

:Repeat
del "C:\Program Files\MM\Uninstall.exe"
if exist "C:\Program Files\MM\Uninstall.exe" goto Repeat
rmdir "C:\Program Files\MM"
del "C:\fiUninst.bat";

Everything else is working, including the line right after rmdir. What could be preventing my script from deleting that folder? After uninstall.exe is successfully deleted, there's nothing left in the folder, so it can't be a straggler file that is preventing deletion. And the 'if exist' loop should guarantee that, by the time the batch file gets to the rmdir line, uninstall.exe is already gone.

-Tony



Sponsored Link
Ads by Google

Response Number 1
Name: Infinite Recursion
Date: June 11, 2004 at 12:36:16 Pacific
Reply:

First, make sure you are not currently using the directory that you are trying to remove.

Then, try this line, instead of the one you are using now...

rmdir /S /Q "C:\Program Files\MM"

IR


0

Response Number 2
Name: ajbufort
Date: June 11, 2004 at 15:20:00 Pacific
Reply:

Hi,

Okay: "not currently using" does not include having it open in Windows explorer, right? Because i know i can delete a folder in a DOS window and have an open explorer window disappear on deletion. But the user DOES have to double-click on the Uninstaller.exe in the MM folder in order to begin the uninstall process. So could it be that, even though my fiUninst.bat script is the one issuing the rmdir command, that command still does not work because the user just clicked on Uninstall.exe a few seconds ago and the MM window still HAS FOCUS?

-Tony


0

Response Number 3
Name: ajbufort
Date: June 11, 2004 at 16:08:23 Pacific
Reply:

Well, I have ruled out that it has anything to do with the explorer window being open or having the focus, as I have tried Uninstall from the DOS command line with no window open and it still fails to delete MM. Now that does not mean that windows does not like that I am in the folder in the first place. But it does rule out some things.

I am currently pursuing the idea that the Uninstall.exe is still in the stack while the .bat is running, thereby preventing Windows from deleting the folder.

-Tony


0

Response Number 4
Name: ajbufort
Date: June 11, 2004 at 16:15:14 Pacific
Reply:

Okay, here's the official scoop:

"
C:\Program Files\MegaMeeting>rmdir "C:\Program Files\MegaMeeting"

The process cannot access the file because it is being used by another process.
"

So there you have it. For some reason, even though my Uninstall.exe has finished running, Windows still thinks the folder is actively being used. Now how do i convince it otherwise?

-tony


0

Response Number 5
Name: ajbufort
Date: June 11, 2004 at 16:42:02 Pacific
Reply:

FORGET IT - I found the problem. After I delete Uninstall.exe, I am still in the Program Files/MM folder!! So being in that folder obviously prevents me from deleting it later in my .BAT file.

-Tony


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: RMDIR from an uninstall.bat

vb6 - gettin maximum from an array www.computing.net/answers/programming/vb6-gettin-maximum-from-an-array/14220.html

Extracting data from an array in C www.computing.net/answers/programming/extracting-data-from-an-array-in-c/8130.html

Function template call from an othe www.computing.net/answers/programming/function-template-call-from-an-othe/11365.html