none
Batch file script to clean up directories and folder RRS feed

  • Question

  • Hello Experts, i am looking for a batch file through which we can delete the files under below locations, honestly i do not know batch scripting , as we have some windows 2003 server where power shell is not installed so if anyone know then please help thanks.

    C:\Windows\SoftwareDistribution\

    C:\Windows\Temp\

    C:\users\*\AppData\Local\Temp

    C:\users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files

    C:\Windows\Downloaded Program Files

    Old ChkDsk Files

    Memory Dump Files

    Internet Cache Files

    Remote Desktop Cache Files

    Setup Log Files

    Wednesday, May 14, 2014 4:33 AM

Answers

  • I tried with basics but that is too basic and looking for to delete the file as mentioned above.

    @echo off
    cd  /d  "c:\folder2"
    rd  /s  /q  "c:\folder2"
    cd  /d  "c:\folder1"
    rd  /s  /q  "c:\folder1"

    Sorry, what you are trying to do requires good batch file skills plus a very good knowledge of where Windows keeps its auxiliary files and which ones can be safely deleted. Furthermore, UAC under Windows Vista and higher will not let you delete files in System folders such as C:\Windows. You need to ask a consultant to assist you.

    Wednesday, May 14, 2014 5:21 AM
  • Frederik Long is correct that this is not a script-on-demand forum.

    I would also add that Windows has a "Disk Cleanup" utility built-in that is designed for this.



    -- Bill Stewart [Bill_Stewart]

    Wednesday, May 14, 2014 2:26 PM
    Moderator

All replies

  • I tried with basics but that is too basic and looking for to delete the file as mentioned above.

    @echo off
    cd  /d  "c:\folder2"
    rd  /s  /q  "c:\folder2"
    cd  /d  "c:\folder1"
    rd  /s  /q  "c:\folder1"

    Wednesday, May 14, 2014 4:35 AM
  • I tried with basics but that is too basic and looking for to delete the file as mentioned above.

    @echo off
    cd  /d  "c:\folder2"
    rd  /s  /q  "c:\folder2"
    cd  /d  "c:\folder1"
    rd  /s  /q  "c:\folder1"

    Sorry, what you are trying to do requires good batch file skills plus a very good knowledge of where Windows keeps its auxiliary files and which ones can be safely deleted. Furthermore, UAC under Windows Vista and higher will not let you delete files in System folders such as C:\Windows. You need to ask a consultant to assist you.

    Wednesday, May 14, 2014 5:21 AM
  • Frederik Long is correct that this is not a script-on-demand forum.

    I would also add that Windows has a "Disk Cleanup" utility built-in that is designed for this.



    -- Bill Stewart [Bill_Stewart]

    Wednesday, May 14, 2014 2:26 PM
    Moderator