Marthax Posted September 1, 2005 Posted September 1, 2005 Hi everyone! I have been inactive for like 2 months on this forum since I've been busy building my new righ, but now I'm back (and it feels great ).Anyway, I have a small problem. When I execute my Cleanup file, I want it to delete 2 folders, "D" (created by BTS Packs) and "Install" (where all my installation files are kept). It does delete everything except one folder inside the Install folder (Office2k3, one file remains here also) and one file in the "D" folder (Watchdriverpolicy.exe, or something like that). When I restart the computer and execute the cmd file manually, it deletes these files. However, if I do the same thing, but unattended, it doesn't delete them. Why is that? I mean, I see the cleanup file get executed, but the folders are still there. I've tried many different methods when timing this file, but with no success.Anyone who knows how I could solve this?Thanks!Marthax
cheezus420 Posted September 1, 2005 Posted September 1, 2005 Try checking out some of the switches that are used with DEL or RMDIR or whatever you are using to delete them. use the /? and see if there are some switches to force a delete. Worth a try
gunsmokingman Posted September 1, 2005 Posted September 1, 2005 Read this thread and it should help you.Clean Up templates
Mojo Posted September 1, 2005 Posted September 1, 2005 Maybe you should terminate the process before deleting the folder (seems to me the file is still in use when you try to delete it).taskkill.exe /F /IM Watchdriverpolicy.exeRD /S /Q %systemdrive%\Install\Hope this helps.
gunsmokingman Posted September 1, 2005 Posted September 1, 2005 (edited) Her try this vbs fileDim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim SD : SD = Act.ExpandEnvironmentStrings("%Systemdrive%")strComputer = "."Set objWMIService = GetObject _ ("winmgmts:\\" & strComputer & "\root\cimv2")Set colProcessList = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'Watchdriverpolicy.exe'")For Each objProcess in colProcessList objProcess.Terminate()NextIf Fso.FolderExists(SD & "\Install") Then Fso.DeleteFolder(SD & "\Install") ElseAct.Popup "Cannot Delete This Folder" , 5, "Delete Error", 0 + 32End If Edited September 1, 2005 by gunsmokingman
Marthax Posted September 1, 2005 Author Posted September 1, 2005 No, it's not that. Maybe I was a bit unclear. If I do it manually, it works. That is, if I execute the cleanup.cmd by hand, it deletes the files, while if I do the same thing, but let RunOnceEx do it, it doesn't get deleted. Why is this?
Sonic Posted September 1, 2005 Posted September 1, 2005 when your cleanup.cmd is launched ? in cmdlines.txt ?
Marthax Posted September 1, 2005 Author Posted September 1, 2005 (edited) No, it's not that. Maybe I was a bit unclear. If I do it manually, it works. That is, if I execute the cleanup.cmd by hand, it deletes the files, while if I do the same thing, but let RunOnceEx do it, it doesn't get deleted. Why is this?<{POST_SNAPBACK}>RunOnceEx. Edited September 1, 2005 by Marthax
cheezus420 Posted September 1, 2005 Posted September 1, 2005 Actually, I have that same problem getting rid of the link for outlook express and Internet explorer in the "all programs" menu. I just assumed that windows re-added them @ bootup, kinda like the "Startup" folder in "all programs". Hopefully someone can help us!!!
Marthax Posted September 2, 2005 Author Posted September 2, 2005 (edited) Hopefully, yes EDIT: If it makes the whole thing easier, then here's my Cleanup.cmd:cmdow /hid@echo offshutdown -f -r -t 25 -c "The computer will restart within 25 seconds"del "%Allusersprofile%\Start Menu\Programs\Adobe Reader 6.0.3.lnk"del "%Allusersprofile%\Desktop\*.*" /Qdel "%Userprofile%\Desktop\*.*" /Qdel "%UserProfile%\Start Menu\Programs\Remote Assistance.lnk" del "%AllUsersProfile%\Desktop\VLC media player.lnk"del "$$\System32\sleep.exe" del "$$\System32\cmdow.exe"del "%Userprofile%\Desktop\Spybot - Search & Destroy.lnk" del "%Userprofile%\Desktop\Skype.lnk" del "%Userprofile%\Desktop\Notepad++.lnk" del "%AllUsersProfile%\Start Menu\Programs\Startup\Adobe Gamma Loader.lnk"del "%UserProfile%\Start Menu\Programs\Outlook Express.lnk"del "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk"del "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"del "%systemdrive%\autoexec.bat"del "%systemdrive%\config.sys"rd "%AllUsersProfile%\Start Menu\Programs\Administrative Tools" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\Nvidia Corporation" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\7-Zip" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\Gaim" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\Mozilla Firefox" /S /Qrd "%Userprofile%\My Documents\My Music" /S /Qrd "%Userprofile%\My Documents\My Pictures" /S /Qrd "%AllUsersprofile%\Start Menu\Programs\Accessories" /S /Qrd "%allUsersprofile%\Start Menu\Accessories" /S /Qrd "%Userprofile%\Start Menu\Programs\Accessories" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\Nero" /S /Qrd "%Userprofile%\My Documents\My Skype Pictures" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\EA Games" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\Spybot - Search & Destroy" /S /Q rd "%AllUsersProfile%\Start Menu\Programs\Skype" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\WinRAR" /S /Qrd "%AllUsersProfile%\Start Menu\Programs\VideoLAN" /S /Qrd "%UserProfile%\Start Menu\Programs\Powertoys for Windows XP" /S /Qrd "%UserProfile%\Start Menu\Programs\XP Codec Pack 1.0.3" /S /Qrd "%UserProfile%\Start Menu\Programs\Notepad++" /S /Qrd "%UserProfile%\Start Menu\Programs\FirstClass" /S/Qrd "%UserProfile%\Start Menu\Programs\Azureus" /S /Qrd "%UserProfile%\Start Menu\Programs\foobar2000" /S /Qrd "%UserProfile%\Start Menu\Programs\arniWORX" /S /Qrd "%UserProfile%\Start Menu\Programs\TrackerV3" /S /Qrd "%Systemdrive%\Drivers" /S /Qrd "%Systemdrive%\temp" /S /Qrd "%Systemdrive%\D" /S /Qrd "%Userprofile%\My Documents\My Pictures\Sample Pictures" /S /Qrd "%Systemdrive%\Install" /S /Qrd "%Systemdrive%\D" /S /QDEL %0 Edited September 2, 2005 by Marthax
Mojo Posted September 2, 2005 Posted September 2, 2005 does it delete all the other folders correctly?maybe try to put the switches before the folder name, likerd /s /q "%SystemDrive%\D"
Mojo Posted September 2, 2005 Posted September 2, 2005 I just assumed that windows re-added them @ bootup, kinda like the "Startup" folder in "all programs".<{POST_SNAPBACK}>cheezus, if yo don't want the startup folder displayed, just run the attrib command on it to hide it (attrib /?).
gunsmokingman Posted September 2, 2005 Posted September 2, 2005 (edited) I was bored and redid Marthax Cleanup.cmd in a VBS Script to show the differences between the 2. This shows only the shutdown dialog, the delete file and folders are silent. Green Text are the arrays for file and folders Dim Act, AllDesk, All_UP, DelFile, DelFolder, Fso, SD, Udesk, User_P Set Act = CreateObject("Wscript.shell") Set Fso = CreateObject("Scripting.FileSystemObject") All_UP = Act.ExpandEnvironmentStrings("%Allusersprofile%") User_P = Act.ExpandEnvironmentStrings("%UserProfile%") SD = Act.ExpandEnvironmentStrings("%Systemdrive%") AllDesk = All_UP & "\Start Menu\Programs" Udesk = User_P & "\Start Menu\Programs" '''' SHUT DOWN Act.Run("shutdown.exe -t 25 -r -f -c ""Preparing To reboot"""), 1,True '''' ARRAY FOR FILES TO DELETE DelFile = Array(All_UP & "\Start Menu\Programs\Adobe Reader 6.0.3.lnk",All_UP & "\Desktop\*.*",_ User_P & "\Desktop\*.*",User_P & "\Start Menu\Programs\Remote Assistance.lnk",All_UP & "\Desktop\VLC media player.lnk",_ User_P & "\Desktop\Spybot - Search & Destroy.lnk",User_P & "\Desktop\Skype.lnk",User_P & "\Desktop\Notepad++.lnk",_ All_UP & "\Start Menu\Programs\Startup\Adobe Gamma Loader.lnk",User_P & "\Start Menu\Programs\Outlook Express.lnk",_ All_UP & "\Start Menu\Set Program Access and Defaults.lnk",All_UP & "\Start Menu\Windows Catalog.lnk",SD & "\autoexec.bat",_ SD & "\config.sys") ''''DELETES ALL THE FILES IN DELFILE For Each StrFile In DelFile If Fso.FileExists(StrFile) Then Fso.DeleteFile(Chr(34) & StrFile & Chr(34)) Else On Error Resume Next End If Next ''''ARRAY TO DELETE FOLDERS DelFolder = Array(AllDesk & "\Administrative Tools",AllDesk & "\Nvidia Corporation",AllDesk & "\7-Zip",_ AllDesk & "\Gaim",AllDesk & "\Mozilla Firefox",User_P & "\My Documents\My Music",User_P & "\My Documents\My Pictures",_ AllDesk & "\Accessories", All_UP & "\Start Menu\Accessories",User_P & "\Start Menu\Programs\Accessories",_ AllDesk & "\Nero",User_P & "\My Documents\My Skype Pictures",AllDesk & "\EA Games", AllDesk & "\Spybot - Search & Destroy",_ AllDesk & "\Skype",AllDesk & "\WinRAR",AllDesk & "\VideoLAN",Udesk & "\Powertoys for Windows XP",Udesk & "\XP Codec Pack 1.0.3",_ Udesk & "\Notepad++",Udesk & "\FirstClass",Udesk & "\Azureus",Udesk & "\foobar2000",Udesk & "\arniWORX",Udesk & "\TrackerV3",_ SD & "\Drivers",SD & "\temp",SD & "\D",User_P & "\My Documents\My Pictures\Sample Pictures",SD & "\Install") ''''DELETES THE FOLDERS For Each StrFolder In DelFolder If Fso.FolderExists(StrFolder) Then Fso.DeleteFolder(Chr(34) & StrFolder & Chr(34)) Else On Error Resume Next End If Next Edited September 2, 2005 by gunsmokingman
Marthax Posted September 2, 2005 Author Posted September 2, 2005 And this means? Sorry, but I'm no expert when it comes to VBS.
gunsmokingman Posted September 2, 2005 Posted September 2, 2005 It was just to show the differences between the 2 that all nothing more.I left these 2 out because I had no idea what the directory was.del "$$\System32\sleep.exe" del "$$\System32\cmdow.exe"
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