Script or command to delete contents of Software Distribution folder?


  1. Posts : 426
    Win7 Ultimate SP1
       #1

    Script or command to delete contents of Software Distribution folder?


    Hi all. Anyone able to suggest a vbs (or command-line file) to clean out C:\Windows\Software Distribution\Download?

    Thanks, I'm aware of the significance (or lack of) of this folder, and I realize I could just drill down to it and manually dump the contents. I'm just looking for a more elegant solution.

    Incidentally, the folder seems to named 'SoftwareDistribution' on my XP machines, but 'Software Distribution' (with a space) on my Win7 pc. Maybe just a glitch in the matrix?

    Cheers
      My Computer


  2. Posts : 4,772
    Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
       #2

    Hello,

    Save the the below text a Notepad. And save it as a batch file. i.e.

    File > Save as > <filename>.bat

    Note: You have to Right Click on the Batch File and Run as administrator

    Code:
    net stop wuauserv
    ren %windir%\SoftwareDistribution SD.old
    net start wuauserv
    Hope this helps,
    Captain
      My Computer


  3. Posts : 426
    Win7 Ultimate SP1
    Thread Starter
       #3

    Thanks Captain, looks like it'll do the trick!
      My Computer


  4. Posts : 426
    Win7 Ultimate SP1
    Thread Starter
       #4

    Later: Sorry, it didn't do the whole job. What I've ended up with after a reboot is:

    a) A folder named SD.old that still contains the original files. What I was aiming at was a quick way of emptying the contents of the SoftwareDistribution\Download folder.

    b) Oddly, perhaps because I routinely disable Windows Update, there's no fresh incarnation of C:\Windows\SoftwareDistribution together with its attendant subfolders. Still, that's no BFD, I guess if Update was turned on, the folder might have been rebuilt.

    Any suggestions?
      My Computer


  5. Posts : 4,772
    Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
       #5

    teckneeculler said:
    Later: Sorry, it didn't do the whole job. What I've ended up with after a reboot is:

    a) A folder named SD.old that still contains the original files. What I was aiming at was a quick way of emptying the contents of the SoftwareDistribution\Download folder.

    b) Oddly, perhaps because I routinely disable Windows Update, there's no fresh incarnation of C:\Windows\SoftwareDistribution together with its attendant subfolders. Still, that's no BFD, I guess if Update was turned on, the folder might have been rebuilt.

    Any suggestions?
    I believe so. We used to rename that folder to troubleshoot Windows Update issues. Once you update through Windows it should rebuild the folder.
      My Computer


  6. Posts : 4,772
    Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
       #6

    To empty the contents you could try this command

    Code:
    del %windir%\SoftwareDistribution\Download\. /f /q
    for /f "tokens=*" %%i in ('dir %windir%\SoftwareDistribution\Download\. /b') do rd "%windir%\SoftwareDistribution\Download\%%i" /s /q
      My Computer


  7. Posts : 426
    Win7 Ultimate SP1
    Thread Starter
       #7

    Thanks for the command. How would it be if I saved it as a bat file?
      My Computer


  8. Posts : 4,772
    Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
       #8

    teckneeculler said:
    Thanks for the command. How would it be if I saved it as a bat file?
    Copy it to a Notepad. Then go to File > Save as > filename.bat and save it. Make sure when you run it right click and run as administrator.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:26.
Find Us