micks80 Posted October 20, 2008 Share Posted October 20, 2008 Hi Friends,I have an unattended installer and to un-install it I have a dos script file e.gC:\MySoftware\uninstall\script.cmdNow, in script.cmd, I try to delete the "MySoftware" folder by issuing this:rmdir /S /Q "C:\MySoftware"But the problem is since the script is inside the folder itself, it deletes everything but cannot delete the two folder and leaves behind these 2 blank folders (MySoftware and uninstall) which the user have to delete manually.Can someone suggest a way how to handle this in a better way so that the whole "MySoftware" folder gets deleted.Thanks a lot. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 20, 2008 Share Posted October 20, 2008 What you're trying to do is not working so you're going to have to try to give us more information so that we can find a suitable work-around! Link to comment Share on other sites More sharing options...
MCT Posted October 20, 2008 Share Posted October 20, 2008 (edited) im not really fluent in dos commands, but i use RD /S /Q "path" to remove my files, always works without a hitchEDIT:what u can try doing is putting script.cmd in a temp directory or something? or u can add a registry entry to runonce so that next time u restart u can have the folder gonebut u cant delete a folder that your file is in Edited October 20, 2008 by MCT Link to comment Share on other sites More sharing options...
jaclaz Posted October 20, 2008 Share Posted October 20, 2008 (edited) You want a self deleting batch? Mind you is RISKY business, however, you need a temp file:save this snippet in your \Mysoftware\uninstall directory, naming it selfdel.cmd or something like thatECHO del %~dpnx0>%~d0\delnow.cmdECHO RD /S /Q %~dp0>>%~d0\delnow.cmdECHO del %~d0\delnow.cmd>>%~d0\delnow.cmd %~d0\delnow.cmd(this will just remove the two batch files and the \uninstall\ subdirectory - just in case - but you can modify it with hardcoded paths to have it remove also the main \mysoftware one)Some more details and examples here:http://catch22.net/tuts/selfdeljaclaz Edited October 20, 2008 by jaclaz Link to comment Share on other sites More sharing options...
micks80 Posted October 20, 2008 Author Share Posted October 20, 2008 Thanks Guys,The copying to TEMP directory idea worked like a charm.I just wrote another batch script like you said and copied it to the TEMP directory before executing the "Rmdir" command...Cheers... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now