Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Script or command to delete contents of Software Distribution folder?


26 Oct 2010   #1

XPPSP3, Win7Ultimate
 
 
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 Windows 7 pc. Maybe just a glitch in the matrix?

Cheers :-)

My System SpecsSystem Spec
.

26 Oct 2010   #2

Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
 
 

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 System SpecsSystem Spec
26 Oct 2010   #3

XPPSP3, Win7Ultimate
 
 

Thanks Captain, looks like it'll do the trick!
My System SpecsSystem Spec
.


26 Oct 2010   #4

XPPSP3, Win7Ultimate
 
 

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 System SpecsSystem Spec
26 Oct 2010   #5

Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
 
 

Quote   Quote: Originally Posted by teckneeculler View Post
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 System SpecsSystem Spec
26 Oct 2010   #6

Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
 
 

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 System SpecsSystem Spec
07 Nov 2010   #7

XPPSP3, Win7Ultimate
 
 

Thanks for the command. How would it be if I saved it as a bat file?
My System SpecsSystem Spec
07 Nov 2010   #8

Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit
 
 

Quote   Quote: Originally Posted by teckneeculler View Post
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 System SpecsSystem Spec
Reply

 Script or command to delete contents of Software Distribution folder?




Thread Tools



Similar help and support threads for2: Script or command to delete contents of Software Distribution folder?
Thread Forum
Folder - Delete from Command Prompt Tutorials
Installing fonts via command line/script General Discussion
How to capture the contents of the clipboard using the command line? Software
command line to delete folder contents Performance & Maintenance
Unable to change folder contents on remote folder in same HomeGroup Network & Sharing
Cannot Delete Files from Software Folder General Discussion
Software Distribution Network & Sharing

Our Sites

Site Links

About Us

Find 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 11:36 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33