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
teckneeculler

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 Win7 pc. Maybe just a glitch in the matrix?

Cheers :-)


My System SpecsSystem Spec
.
26 Oct 2010   #2
Capt.Jack Sparrow

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
teckneeculler

XPPSP3, Win7Ultimate
 
 

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

26 Oct 2010   #4
teckneeculler

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
Capt.Jack Sparrow

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
Capt.Jack Sparrow

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
teckneeculler

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
Capt.Jack Sparrow

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
Thread Forum
Folder - Delete from Command Prompt
How to Delete a Folder in Windows from the Command Prompt This will show you how to permanently delete a Folder in Vista, Windows 7, or Windows 8 using the RD or RMDIR command from within a command prompt. This can be handy if you cannot delete the folder using the normal methods. ...
Tutorials
Delete Folder Content Software
Looking to delete content of a folder but want to keep the folder. I have to do this often for a flight simulator program. I cannot simply overwrite to files in to folder. So, I just would just like to do something like right click and empty the folder content but keep the folder. I googled and...
General Discussion
How to capture the contents of the clipboard using the command line?
There are lots of sites discussing how to redirect the output of the command line to the clipboard but nothing covering the opposite. I want to capture a link address I have copied to my clipboard and send it to a command line program, as a variable, in a script. Clip.exe seems to be the only...
Software
command line to delete folder contents
What line in a batch file would delete the contents of C:\Users\MyName\AppData\Local\Microsoft\Windows\Temporary Internet Files\ ? del /F /S /Q /A "C:\Users\MyName\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" fails, so does del...
Performance & Maintenance
Unable to change folder contents on remote folder in same HomeGroup
Hello, first I want to apologize up front if this topic has already been posted with the problem resolution as well. I have searched throughout the networking and sharing threads but was unable to find what I'm looking for... I have two computers in my home, a Tower PC and a Laptop both...
Network & Sharing
Cannot Delete Files from Software Folder
I have a bundled copy of Cyberlinks PDVD8 which is locking files in the VideoFilter folder - I can't take ownership of the files and get the message "Access Denied". When I try to reinstall the software it won't work because of the locked files. I can install it in another folder but the same...
General Discussion

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 02:01.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App