Coreper Posted May 28, 2007 Report Share Posted May 28, 2007 i downloaded this program a few days ago, but it only was a program without an installation fileso i thought:lets make an Start Menu folder for it, and a Program Files folder, no problems therebut i thought it would be nice if i could uninstall it so i dont have to manually delete itso i thought of creating a batch file which would remove the Start Menu and Program Files folderbut that is where the problems occure:when i run my dos batch file, it only deletes the files inside the File_Renamer folderhere is my batch file [uninstall.bat]@echo offecho Uninstalling...@echo offcd C:\Documents and Settings\All Users\Menu Start\Programma'sDEL File_Renamercd C:\Program FilesDEL File_Renamerecho Done!@echo offpauseexitdoes someone know how to make it delete the folder, instead of the files inside?and how can i make it that it doesnt asks me to delete the files, but just does it? [is that the /Q addition?]please helpthanks Quote Link to comment Share on other sites More sharing options...
Coreper Posted May 28, 2007 Author Report Share Posted May 28, 2007 anyone? Quote Link to comment Share on other sites More sharing options...
Scarecrow Man Posted May 28, 2007 Report Share Posted May 28, 2007 Your code will delete the folder itself, not the files inside. To delete the files inside, you must specify the file or use the *.* for all.I know of a command called DELTREE which will delete any folder tree underneath the tree specified. For exmaple:C:\Folder1\Folder2\--------------\File1------------------------\Folder3\File2runing the command deltree C:\folder1\folder2 will delete folder3, file2 and file1. I hope my diagram makes sense.Maybe this will help:http://www.computerhope.com/msdos.htm Quote Link to comment Share on other sites More sharing options...
Coreper Posted May 29, 2007 Author Report Share Posted May 29, 2007 so if i would like to apply it, i should use:DELTREE C:\Documents and Settings\All Users\Menu Start\Programma's\File_Renamer /YDELTREE C:\Program Files\File_Renamer /Ycd C:\Documents and Settings\All Users\BureaubladDEL File_Renamer.Ink /Qbtw: my current code does remove the files from a folder, but leaves the folder where it is... Quote Link to comment Share on other sites More sharing options...
Chris Posted May 29, 2007 Report Share Posted May 29, 2007 RMDIR /S /Q "C:\Documents and Settings\All Users\Menu Start\Programma's\File_Renamer" B)The use of DELTREE or RMDIR depends on the OS.Also you only need to state @ECHO OFF just the once. Quote Link to comment Share on other sites More sharing options...
Scarecrow Man Posted May 29, 2007 Report Share Posted May 29, 2007 The use of DELTREE or RMDIR depends on the OS.RMDIR!!!! That's the one I was thinking of! Boy it's been a while since I used dos. Regarding @ECHO...@ECHO OFFwill turn off the location of where the file is run from. For example C:\ECHO OFF will turn off every line, until the ECHO ON command is used. (I think) B) Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 3, 2007 Author Report Share Posted June 3, 2007 ok, i tried [sorry for the late reply]but again it doesnt delete the C:\Program Files\File_Renamer foldercould that be because the uninstall.bat file is in that folder?btw: the DELTREE command is not recognized... Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 4, 2007 Report Share Posted June 4, 2007 how about simply using RD??? it aquireses some /? /? 's if the folder aint empty, but it should be... Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 4, 2007 Author Report Share Posted June 4, 2007 what is RD? Quote Link to comment Share on other sites More sharing options...
Chris Posted June 4, 2007 Report Share Posted June 4, 2007 There must be an error message...being displayed? Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 4, 2007 Author Report Share Posted June 4, 2007 not reallyit just works properly, but the folders are just not removed [while the content is] Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 4, 2007 Report Share Posted June 4, 2007 RD is a command, and short for Remove Directory.It works in all the command prompts i got at xp and vista. Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 4, 2007 Author Report Share Posted June 4, 2007 ok, that worked to remove the folder, but i still cant remove the folder where the uninstall.bat file is located... [it wont get deleted > no error message]i think that is because it deletes itself before it can remove the folder...is there a ay to solve this? Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 4, 2007 Report Share Posted June 4, 2007 RD /S /Q [folder] Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 5, 2007 Author Report Share Posted June 5, 2007 i know, i already used that:@echo offecho Uninstalling...@echo offpauseRD "C:\Documents and Settings\All Users\Menu Start\Programma's\File_Renamer" /QDEL "C:\Documents and Settings\All Users\Bureaublad\File_Renamer.Ink" /QRD "C:\Program Files\File_Renamer" /Q /SRD "C:\Program Files\File_Renamer" /Qecho Done!@echo offpauseexitwhen i move the last t20 RD command lines more up, everything after that isnt done > it deletes itselve...is there a way to fix that? Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 5, 2007 Report Share Posted June 5, 2007 just dont delete the file untill your fully done...so what i would do:copy "the uninstaller" c:\documents and settings\U S E R\temp\uninstaller.batc:\documents and settings\U S E R\temp\uninstaller.batINSERT DELETE CODEecho Donepausedel c:\documents and settings\U S E R\temp\uninstaller.bat Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 6, 2007 Author Report Share Posted June 6, 2007 but doesnt that require you to swith to the other batch file and run it?how can i run another batch file from a batch file...?or do i just understand it wrong?, 'cause when you copy the file nothing will happen, you will only copy the file, so you also need to run it, but how do you do that?wouldnt you have to know how to edit the content of that batch file? Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 7, 2007 Report Share Posted June 7, 2007 if you copy the batch file (and makes sure the batch file only contains absolute path names, instead of relative i.e. c:\dir\anotherdir\file.txt instead of \anotherdir\file.txt )And then just call the file (which i showed in the second line:c:\documents bla bla bla \uninstaller.batthe batch file should be run (and keep running, even if its caller is deleted). Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 7, 2007 Author Report Share Posted June 7, 2007 so i should do something like this:1 copy current batch file2 run copied batch file3 exitcopied batch file:4 delete all files from the program [including the original batch file so i cant be copied any more]5 exit Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 13, 2007 Author Report Share Posted June 13, 2007 ok this is what i have now:@echo offecho Uninstalling...@echo offpauseCOPY "C:\Program Files\map\Uninstall.bat" "C:"cd C:Uninstall.batRD "C:\Documents and Settings\All Users\Menu Start\Programma's\map" /QDEL "C:\Documents and Settings\All Users\Bureaublad\map" /QRD "C:\Program Files\map" /Q /SRD "C:\Program Files\map" /QDEL "C:\Uninstall.bat"echo Done!@echo offpauseexitbut i cant seem to run the C:\Uninstall.bat filehow can i do thisand will this batch file remove:-the C:\Program Files\map directory-the map shortcut from the desktop-the map folder from the start menu-the uninstall.bat copy from C:? Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 14, 2007 Report Share Posted June 14, 2007 The idea is to move this file to anywhere else then the folder in question.Then run it.When it runs, be sure you have the full paths of everything, since relative paths won't work from all directories.The final line of this file, is to delete itself.This is the easiest solution, since making it "selfcopy", in case its in the dir, and making it skipping the "selfcopy" when its copied, is a rather complicated thing to explain - but doable!!And the reason for not deleting the file while in the dir, is to be sure the dir, and all in it is gone, before saying "uninstall complete"...@echo offecho Uninstalling...@echo offpauseRD "C:\Documents and Settings\All Users\Menu Start\Programma's\File_Renamer" /QDEL "C:\Documents and Settings\All Users\Bureaublad\File_Renamer.Ink" /QRD "C:\Program Files\File_Renamer" /Q /SRD "C:\Program Files\File_Renamer" /Qecho Done!@echo offpauseDEL uninstaller.bat Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 15, 2007 Author Report Share Posted June 15, 2007 ok ik improved it a bit again:@echo offecho Uninstalling...@echo offpauseCOPY "C:\Program Files\map\Uninstall.bat" "C:"START "C:\Uninstall.bat"RD "C:\Documents and Settings\All Users\Menu Start\Programma's\map" /QDEL "C:\Documents and Settings\All Users\Bureaublad\map.ink" /QRD "C:\Program Files\map" /Q /SRD "C:\Program Files\map" /QDEL "C:\Uninstall.bat"echo Done!@echo offpauseexitremoves:-start menu folder-program files folder contectdoesnt remove:-program files folder-desktop shortcutand i get this window after i run the batch file [attached]@mcb2001: what is the difference with your code, and my ones, which didnt work? Quote Link to comment Share on other sites More sharing options...
mcb2001 Posted June 15, 2007 Report Share Posted June 15, 2007 Okay, to be honest, i use lower case all the time, to be sure, and the "at" sign @ is useless, if you just run "echo off" in the first line, you get echo turned off, and then its on for the rest of the "program"."rd" should work - if you use BOTH /S and /Q in order to remove it ALL without asking."del" should work - if you use BOTH /F and /Q in order to remove even locked file, without even asking."echo" should work (even better with "echo off")So copy this into a file, when you wanna uninstall the programm, just copy the uninstaller to the desktop, run it, and let it delete everything, including itself...echo offecho Uninstalling...pauserd "C:\Documents and Settings\All Users\Menu Start\Programma's\File_Renamer" /S /Qdel "C:\Documents and Settings\All Users\Bureaublad\File_Renamer.Ink" /F /Qrd "C:\Program Files\File_Renamer" /S /Qrd "C:\Program Files\File_Renamer" /S /Qecho Done!pauseDEL uninstaller.bat /F /Q Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 15, 2007 Author Report Share Posted June 15, 2007 but that is the problemi dont want to copy the uninstaller to the desktop > i want to have it uninstalling a program just like those "real" uninstallers Quote Link to comment Share on other sites More sharing options...
Coreper Posted June 20, 2007 Author Report Share Posted June 20, 2007 any other suggestions?or is there maybe an easy way to create a "real" uninstaller? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.