Zoom7000 Posted December 19, 2008 Posted December 19, 2008 I mainly use addons in my RIS installations and have been finding that there have been loads of folders with addon installations files left over in the "Default User" profile that is causing delayed logon times when users log on after a PC has been rebuilt.On investigating, I find that the folders left over all start 7z with a random 4 character string after it and ends in .tmpExample:7zSBCA.tmp7zSC1d.tmp7zSC02.tmp7zSC9c.tmp7zSCA5.tmp7zSBCC.tmp7zSC1F.tmp7zSC3A.tmp7zSB04.tmp7zSC9F.tmp7zSC86.tmp7zSCA8.tmp7zSCA9.tmpIs there anyway I can delete these files before logon? I tried a script, but the 4 character string after 7z changes all the time. Quote
ricktendo Posted December 19, 2008 Posted December 19, 2008 Use a Star a.k.a. Asterisk (*), and something like this should do it:CMD /C DEL /F /Q "%AllUsersProfile%\..\Default User\7z*.tmp"EDIT: Crapt it does not work, I think because its a hidden folder so the CMD cannot see it when I am logged in Quote
Nomadturk Posted December 19, 2008 Posted December 19, 2008 (edited) For that, i'm using a custom cmd file to remove leftover files that i don't want.Try using the code below. When i tried, it worked.Save it as Cleanup.cmd and add it to your RunOnceEx.cmd file.Cleanup.cmdcmdow @ /HID@echo offDEL /F /Q "%systemdrive%\Documents and Settings\Default User\7z*.tmp"EXITAlso, i was using this for folder deletions.del "%systemdrive%\Documents and Settings\Default User\OpenOffice.org 2.4 (tr) Installation Files" /Q /S /F Edited December 19, 2008 by Nomadturk Quote
Zoom7000 Posted December 20, 2008 Author Posted December 20, 2008 This doesn't work for me. I find that the "DEL" command deletes files, but not folders. For deleting folders you need to use "RD" or "RMDIR" command. However, I don't know how you can use a wildcard with "RD" or "RMDIR". Quote
Nomadturk Posted December 20, 2008 Posted December 20, 2008 I think you can't. You'll have to enter them manually. That's what i did. Quote
Nomadturk Posted December 20, 2008 Posted December 20, 2008 (edited) Well, this way you can delete folders. But this is as much i could do it. This script below deletes files any folders starting with "7z" from within your default users directory.BUT, if there are any files in that directories, you may need to run the script twice. It first deletes the inner contents of directories. Second run deletes the folders themselves. (Sometimes... 3-4 runs needed.)I don't know if you can run this at installation stage. But if you can, you can do it by the code below.wscript DeleteFolders.vbsName this as DeleteFolders.vbs and try.strComputer = "."Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colFolders = objWMIService.ExecQuery _ ("Select * from Win32_Directory where Name Like '%C:\\Documents and Settings\\Default User\\7z%'")Set colFiles = objWMIService.ExecQuery _ ("Select * from Win32_Directory where Name Like '%C:\\Documents and Settings\\Default User\\7z%\\'") For Each objFolder in colFolders errResults = objFolder.DeleteNextWell, give it a try. Hope it might help you.I sure learnt something while searching for this. (:You may improve it yourself. Edited December 20, 2008 by Nomadturk Quote
ricktendo Posted December 20, 2008 Posted December 20, 2008 AHH! Yes no wonder it did not work we were using the wrong command, try something like this it works:FOR /F %%I IN ('DIR /B "%SYSTEMDRIVE%\Documents and Settings\Default User\7z*.tmp"') DO RD /S /Q "%SYSTEMDRIVE%\Documents and Settings\Default User\%%I" Quote
Guest DennyMK Posted December 23, 2008 Posted December 23, 2008 Right question @Zoom7000 and thanks to @Ricktendo64 and @Nomadturk for answers. I'll give it a try :beerchug: .By the way: Merry Christmas Quote
Zoom7000 Posted December 28, 2008 Author Posted December 28, 2008 Thanks ricktendo64, I haven't tried it yet because I've been away for the xmas break. I asked the same question on neowin and got told to try a similar command.FOR /D %F IN ("C:\Documents and Settings\Default User\7z*.tmp") DO RD /S /Q "%F" Quote
ricktendo Posted December 28, 2008 Posted December 28, 2008 I dont think that the star a.k.a. asterisk (*) flag will work with RD but with DIR /B it will make a detailed list of all the 7z*.tmp and it will delete them one by oneFOR /F %%I IN ('DIR /B "%SYSTEMDRIVE%\Documents and Settings\Default User\7z*.tmp"') DO RD /S /Q "%SYSTEMDRIVE%\Documents and Settings\Default User\%%I" Quote
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.