In need of a script...

Gornot

Professional Slacker
Guru
Gold Member
VIP
Local time
3:25 PM
Messages
2,288
Location
Belgrade, Serbia
I am looking for a script which can delete cookies, Windows + browser cache automatically on a regular (scheduled) basis. Can this be done through Windows itself or would i have to implement a custom script or something?

I am looking to replace CCleaner and similar software package(s). Just now I troubleshooted my sister's PC with an expert who said that stuff like Ccleaner is nothing but trouble. He removed the garbage files manually through Total Commander (ugh), but honestly I can't be bothered to barge into my sis' room every couple of days and ravage through AppData folders to remove temp data and cookies.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Home Premium x64
CPU
Intel Core i5 2500K
Motherboard
MSI MS-7750
Memory
8GB DDR3
Graphics Card(s)
nVidia GeForce GTX650 Ti BOOST
Sound Card
Realtek
Monitor(s) Displays
21' Philips
Screen Resolution
Full HD
Hard Drives
1TB
PSU
500W
have you tried windows disk cleanup?

just type cleanup into the start-menu search-box.

*edit* sorry, re-reading your post it seems you want to automate it.

you can use task-scheduler to (wait-for-it) schedule tasks, but i don't know how to automate the cleanup options...read this tutorial - it's for an annual (!) cleanup, but can be easily modified.
 

My Computer

Computer Manufacturer/Model Number
mickey megabyte 1234
OS
ultimate 64 sp1
CPU
i5 2500K [email protected]
Motherboard
MSI P67A-GD53
Memory
8 gigs GSkill Ripjaws 1600
Graphics Card(s)
amd hd6950
Sound Card
creative x-fi gamer
Monitor(s) Displays
samsung 24"
Screen Resolution
1920x1080
Hard Drives
ocz vertex 2e 60 gig, samsung f3 1tb, buffalo 2tb ext
PSU
antec 550
Case
antec three hundred
Cooling
i'm a cooling fan
Keyboard
saitek eclipse ii
Mouse
logitech g3
Internet Speed
about 4 Mbps
Other Info
i love win7
Ah, I see now xD
Thanks, will try it, hope it works.
In the meantime, I'd like to hear more suggestions and/or confirmation of efficiency by using this kind of process instead of stuff like Ccleaner (and similar).
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Home Premium x64
CPU
Intel Core i5 2500K
Motherboard
MSI MS-7750
Memory
8GB DDR3
Graphics Card(s)
nVidia GeForce GTX650 Ti BOOST
Sound Card
Realtek
Monitor(s) Displays
21' Philips
Screen Resolution
Full HD
Hard Drives
1TB
PSU
500W
+1 For Windows disk Clean Up.

It doesn't do any damage and safetly cleans out everything.

The scheduler appears to run as Administrator so it should be thorough.

Weekly looks good or sooner if wanted. Or on start up though it may slow start up a bit.

My 2 pennies.
Mike
 

My Computer

Computer Manufacturer/Model Number
Hopalong/ Godzilla
OS
Windows7 Pro 64bit SP-1; Windows XP Pro 32bit
CPU
Intel Core i7-870 Lynnfield 2.93GHz LGA 1156 95W Quad-Core
Motherboard
ASUS P7P55D-E PRO
Memory
8GB@1400MHz Crucial Ballistix DDR3-1600 4x2GB
Graphics Card(s)
ASUS ENGTX460 DirectCU/2DI/1GD5 1GB 256-bit GDDR5
Sound Card
VIA Onboard
Monitor(s) Displays
Asus VS248H-P 24"; Samsung SyncMaster 941BW 19"ws
Screen Resolution
1920x1080; 1440x900
Hard Drives
Samsung 830 120GB SSD
Intel 320 120GB SSD
Western Digital Caviar Black WD7501AALS 750GB 7200 RPM SATA 3.0Gb/s
Western Digital Caviar Black WD6401AALS 640GB 7200 RPM SATA 3.0Gb/s
PSU
COOLER MASTER Silent Pro RS850-AMBAJ3-US 850W Modular
Case
COOLER MASTER HAF 932 RC-932-KKN5-GP Black
Cooling
Scythe "Mugen-2 Rev.B" (2 ScytheKaze-Jyuni PWM fans)
Keyboard
Logitech K-320
Mouse
Kensington
Antivirus
Avast Inernet Suite
Browser
IE 9 ; Chrome
You can schedule CCleaner to run automatically once you've set it up the way you want. Not what you asked but thought I'd throw it out here anyway. CCleaner accepts command line parameters. See here:

Piriform - Command-line parameters

eg:

CCleaner.exe /AUTO CCleaner runs silently and automatically, using the current set of saved options to clean the PC. CCleaner then exits.

CCleaner.exe /AUTO /SHUTDOWN CCleaner runs silently and automatically, using the current set of saved options to clean the PC. Windows then shuts down automatically..

Note: You cannot run /SHUTDOWN by itself. It must be preceded by /AUTO.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Mickey's solution was great. If you wanted to create a batch file ...


DEL /S/F/Q "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*"
DEL /S/F/Q "%USERPROFILE%\Cookies"
DEL /S/F/Q "%USERPROFILE%\Recent"
DEL /S/F/Q "%USERPROFILE%\Local Settings\History"
endif
 

My Computer

Computer Manufacturer/Model Number
Dell and Custom
OS
Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
CPU
System 1: i7 [email protected], System 2: AMD FX-4100 Zambezi 3.6G
Motherboard
System 1:Dell 06NWYK System 2: ASUS M5A97 AM3+
Memory
System 1: 8GB System 2: 8GB
Graphics Card(s)
System 1: ATI FirePro V4800 System 2: Radeon HD 6850
Sound Card
System 1: onboard System 2: onboard
Monitor(s) Displays
System1: Viewsonic HDMI 24"
Screen Resolution
System 1: 1920x1080 System 2: 1920x1080
Hard Drives
System 1: Mirrored .5B drives System 2: Seagate Barracuda ST1000DM003 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s
Case
System 1: Dell System 2: Cooler Master
Internet Speed
10 MBPS
Thanks, Lemur :D
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Home Premium x64
CPU
Intel Core i5 2500K
Motherboard
MSI MS-7750
Memory
8GB DDR3
Graphics Card(s)
nVidia GeForce GTX650 Ti BOOST
Sound Card
Realtek
Monitor(s) Displays
21' Philips
Screen Resolution
Full HD
Hard Drives
1TB
PSU
500W
Mickey's solution was great. If you wanted to create a batch file ...


DEL /S/F/Q "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*"
DEL /S/F/Q "%USERPROFILE%\Cookies"
DEL /S/F/Q "%USERPROFILE%\Recent"
DEL /S/F/Q "%USERPROFILE%\Local Settings\History"
endif

Lemur, respectfully there are several problems with this script.

1) Most of those files do not exist in those places. They are junction points to the real place the files are stored. So if you look in "%USERPROFILE%\Recent" from the Command Prompt you will see that is it empty. You really need to go to:

"%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent"

2) Plus you don't want to delete the desktop.ini files in those folders. Not that it will destroy anything but it will remove the pretty icons and the way the folder functions when you look at them in Windows Explorer. -WS
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell OP7010
OS
Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
Memory
16GB
Monitor(s) Displays
4 Dell 24" LCD
Screen Resolution
1280x1024
Keyboard
Dell
Mouse
Dell Optical
Internet Speed
40meg
Thanks for the input, WS, I set up the cleanup utility and scheduled it to run every few days, so it's good ;)
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Home Premium x64
CPU
Intel Core i5 2500K
Motherboard
MSI MS-7750
Memory
8GB DDR3
Graphics Card(s)
nVidia GeForce GTX650 Ti BOOST
Sound Card
Realtek
Monitor(s) Displays
21' Philips
Screen Resolution
Full HD
Hard Drives
1TB
PSU
500W
Mickey's solution was great. If you wanted to create a batch file ...


DEL /S/F/Q "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*"
DEL /S/F/Q "%USERPROFILE%\Cookies"
DEL /S/F/Q "%USERPROFILE%\Recent"
DEL /S/F/Q "%USERPROFILE%\Local Settings\History"
endif

Lemur, respectfully there are several problems with this script.

1) Most of those files do not exist in those places. They are junction points to the real place the files are stored. So if you look in "%USERPROFILE%\Recent" from the Command Prompt you will see that is it empty. You really need to go to:

"%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent"

2) Plus you don't want to delete the desktop.ini files in those folders. Not that it will destroy anything but it will remove the pretty icons and the way the folder functions when you look at them in Windows Explorer. -WS

YIKES! My bad. Old script. Sorry :o
 

My Computer

Computer Manufacturer/Model Number
Dell and Custom
OS
Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
CPU
System 1: i7 [email protected], System 2: AMD FX-4100 Zambezi 3.6G
Motherboard
System 1:Dell 06NWYK System 2: ASUS M5A97 AM3+
Memory
System 1: 8GB System 2: 8GB
Graphics Card(s)
System 1: ATI FirePro V4800 System 2: Radeon HD 6850
Sound Card
System 1: onboard System 2: onboard
Monitor(s) Displays
System1: Viewsonic HDMI 24"
Screen Resolution
System 1: 1920x1080 System 2: 1920x1080
Hard Drives
System 1: Mirrored .5B drives System 2: Seagate Barracuda ST1000DM003 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s
Case
System 1: Dell System 2: Cooler Master
Internet Speed
10 MBPS
Back
Top