Haris1977 Posted May 26, 2020 Posted May 26, 2020 (edited) Greetings I m trying to create a batch file in a way that - if i run it - it will delete the content inside specific folders: Those folders are the below: C:\Windows\Prefetch C:\Windows\Temp C:\Users\Haris\AppData\Local\Temp Can anyone help? Thanks Edited May 26, 2020 by Haris1977
jaclaz Posted May 26, 2020 Posted May 26, 2020 (edited) 1 hour ago, Haris1977 said: Greetings I m trying to create a batch file in a way that - if i run it - it will delete the content inside specific folders: Those folders are the below: And what have you tried (that presumably did not work as you expected)? Or is the request slightly different, more *like* "please write for me a batch that does this ..." Anyway, see if any of the solutions here fits your usage: https://stackoverflow.com/questions/6836566/batch-file-delete-all-files-and-folders-in-a-directory Easiest is to use RD and the re-create the "base folder", but it is to be seen if that is OK in your situation (basically the recreated "base" directory will have a different creation date", Additionally if the volume - as it is likely the case - is NTFS, there might be the need to check for hardinks before deleting files unconditionally . jaclaz Edited May 26, 2020 by jaclaz
Haris1977 Posted May 26, 2020 Author Posted May 26, 2020 (edited) Thanks for your answer I ve managed to create this script: del /s /f /q "C:\Windows\Prefetch\*.*" del /s /f /q "C:\Windows\Temp\*.*" del /s /f /q "C:\Users\Haris\AppData\Local\Temp\*.*" echo Deleting Files! timeout /t 3 While it works, inside "prefetch" folder there are still 4files that are recreated when the batch file ends: CMD.EXE-8E75B5BB.pf CONHOST.EXE-E6AFC9F5.pf TIMEOUT.EXE-579F197A.pf DLLHOST.EXE-57A853C4.pf Any idea why those files are re created? Edited May 26, 2020 by Haris1977
jaclaz Posted May 27, 2020 Posted May 27, 2020 12 hours ago, Haris1977 said: While it works, inside "prefetch" folder there are still 4files that are recreated when the batch file ends: CMD.EXE-8E75B5BB.pf CONHOST.EXE-E6AFC9F5.pf TIMEOUT.EXE-579F197A.pf DLLHOST.EXE-57A853C4.pf Any idea why those files are re created? Sure , I would say it is "normal". The prefetch folder is where Windows automagically creates *something* (let's call for the moment this *something* "links") connected to frequently used executables. Cmd.exe and Timeout.exe are the command processor (that runs the batch) and the command you used in the batch, conhost.exe is as well connected to the command processor (it is the console host) and dllhost.exe (likely, haven't checked) is connected to timeout.exe (or as well to cmd.exe). If you don't want them to be recreated you need to disable prefetch: https://www.technipages.com/windows-enable-disable-superfetch It may also depend on its actual setting, check the values in: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management\PrefetchParameters EnablePrefetcher EnableSuperfetch https://www.tomshardware.com/reviews/ssd-performance-tweak,2911-5.html jaclaz
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now