2009-04-16 20 views
1

Erstellen Sie einfach eine Batch-Datei, um temporäre Dateien auf meinen Vista-Maschinen @ home zu löschen, die ich dem Taskplaner hinzufügen möchte. Ich habe dies bisher, aber ich bekomme eine Menge Zugriff verweigert, und es findet nie eine thumbs.db-Datei oder index.dat und es gibt jede Menge davon. Was mache ich falsch?Temporäre Dateien in Batch-Datei löschen

attrib +a -s -h -r "%windir%\Temp\*.*" /s 
    del /f /s /q "%windir%\Temp\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "thumbs.db" /s 
    del /s /f /q "thumbs.db" >>"logs\temp.txt" 

attrib +a -s -h -r *.tmp.log /s 
    del /s /f /q "*.tmp.log" >>"logs\temp.txt" 

attrib +a -s -h -r “%userprofile%\Application Data\Microsoft\Office\Recent\*.*” /s 
    del /f /q /s “%userprofile%\Application Data\Microsoft\Office\Recent\*.*” >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.gid" /s 
    del /s /f/q "%systemdrive%\*.gid" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.fts" /s 
    del /s /f /q "%systemdrive%\*.fts" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.cnt" /s 
    del /s /f /q "%systemdrive%\*.cnt" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.old" /s 
    del /s /f /q "%systemdrive%\*.old" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.diz" /s 
    del /s /f /q "%systemdrive%\*.diz" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.bak" /s 
    del /s /f /q "%systemdrive%\*.bak" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.tmp" /s 
    del /s /f /q "%systemdrive%\*.tmp" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.chk" /s 
    del /s /f /q "%systemdrive%\*.chk" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.dmp" /s 
    del /s /f /q "%systemdrive%\*.dmp" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.00?" /s 
    del /s /f /q "%systemdrive%\*.00?" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\index.dat" /s 
    del /s /f /q "%systemdrive%\index.dat" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\fw*log.txt" /s 
    del /s /f /q "%systemdrive%\fw*log.txt" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\zalog*.txt" /s 
    del /s /f /q "%systemdrive%\zalog*.txt" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\backup*.rdb" /s 
    del /s /f /q "%systemdrive%\backup*.rdb" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*._mp" /s 
    del /f /s /q %systemdrive%\*._mp >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\*.log" /s 
    del /f /s /q "%systemdrive%\*.log" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Temp\*.*" /s 
    del /f /s /q "%systemdrive%\Temp\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\History\*.*" /s 
    del /f /s /q "%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\History\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" /s 
    del /f /s /q "%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Users\Default\AppData\Local\Temp\*.*" /s 
    del /f /s /q "%systemdrive%\Users\Default\AppData\Local\Temp\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Cookies\*.*" /s 
    del /f /s /q "%systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Cookies\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Recent\*.*" /s 
    del /f /s /q "%systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Recent\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%systemdrive%\Windows\Downloaded Program Files\*.*" /s 
    del /f /s /q "%systemdrive%\Windows\Downloaded Program Files\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%ProgramData%\Apple\Installer Cache\*.*" /s 
    del /f /s /q "%ProgramData%\Apple\Installer Cache\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%ProgramData%\Apple Computer\Installer Cache\*.*" /s 
    del /f /s /q "%ProgramData%\Apple Computer\Installer Cache\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%ProgramData%\Microsoft\Search\Data\Temp\*.*" /s 
    del /f /s /q "%ProgramData%\Microsoft\Search\Data\Temp\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%ProgramData%\Temp\*.*" /s 
    del /f /s /q "%ProgramData%\Temp\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Adobe\Flash Player\AssetCache\*.*" /s 
    del /f /s /q "%appdata%\Adobe\Flash Player\AssetCache\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Macromedia\Flash Player\#SharedObjects\*.*" /s 
    del /f /s /q "%appdata%\Macromedia\Flash Player\#SharedObjects\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\*.*" /s 
    del /f /s /q "%appdata%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\*.*" /s 
    del /f /s /q "%appdata%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Microsoft\Windows\Cookies\*.*" /s 
    del /f /s /q "%appdata%\Microsoft\Windows\Cookies\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Microsoft\Windows\Recent\*.*" /s 
    del /f /s /q "%appdata%\Microsoft\Windows\Recent\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Mozilla\Firefox\Crash Reports\*.*" /s 
    del /f /s /q "%appdata%\Mozilla\Firefox\Crash Reports\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Sun\Java\Deployment\cache*.*" /s 
    del /f /s /q "%appdata%\Sun\Java\Deployment\cache*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\uTorrent\*.*" /s 
    del /f /s /q "%appdata%\uTorrent\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Temp" /s 
    del /f /s /q "%userprofile%\AppData\Local\Temp" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\LocalLow\Temp" /s 
    del /f /s /q "%userprofile%\AppData\LocalLow\Temp" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows Photo Gallery\Original Images\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows Photo Gallery\original Images\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows\Burn\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\Burn\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows\History\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\History\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles\*\Cache\*.*" /s 
    del /f /s /q "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles\*\Cache\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.db" /s 
    del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.db" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Microsoft\Windows\cookies\*.*" /s 
    del /f /s /q "%appdata%\Microsoft\Windows\cookies\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%appdata%\Microsoft\Windows\Recent\*.*" /s 
    del /f /s /q "%appdata%\Microsoft\Windows\Recent\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%windir%\prefetch\*.*" /s 
    del /f /s /q "%windir%\prefetch\*.*" >>"logs\temp.txt" 

attrib +a -s -h -r "%windir%\SoftwareDistribution\Download\*.*" /s 
    del /f /s /q "%windir%\SoftwareDistribution\Download\*.*" >>"logs\temp.txt" 
+0

Warum nicht versuchen, die Batchdatei aus der Administrator-Konsole laufen zu lassen? – dirkgently

+0

Das könnte die Fehler, die von der Berechtigung verweigert wurden, entfernen (nicht unbedingt, da der Administrator standardmäßig nicht auf alles zugreifen kann). Aber das macht die Teile mit% userprofile% wahrscheinlich ziemlich nutzlos. – Joey

Antwort

1

Ich vermute, dass der Grund, warum bist du Zugriff verweigert bekommen, weil der Benutzer das Skript ausgeführt hat keine Rechte auf die fraglichen Dateien löschen oder vielleicht sogar Zugriffsrechte auf die Ordner.

Wie bei den Dateien thumbs.db und index.dat handelt es sich um verborgene Dateien und/oder Systemdateien, die nicht vom Befehl zum Löschen von Dateien abgerufen werden. Sie müssen/A: H und/oder/A: S

2

Haben Sie daran gedacht, den Zielordner beim Festlegen neuer Attribute und Löschen zu setzen?

Hier ist ein Beispiel für Dateien Daumen Löschen Targeting-Netzwerk:

attrib +a -s -h -r \\your-sample-network-path\thumbs.db /s 
del /s /f /q \\your-sample-network-path\thumbs.db 
Verwandte Themen