Windows Utility Scripts

Source: Internet
Author: User

Organize a few more command tool scripts that are used on everyday windows.

Delete all files in directory and directory

@echo on
CD/D E:\test
FOR/R%%s in (., *) do rd/q/s%%s\ new Folder
Exit


REM Deletes all the specified folders under a directory


Second, automatic compression after deletion

@echo off
xcopy d:\inetpub\4fweb\* D:\Inetpub\taosf.bak\/s
CD \
cd c:\program Files
CD winrar
Rar.exe a-ag-r-m5-df D:\DB_back\hjl_taosf.rar D:\Inetpub\taosf.bak\
Pause


Three, automatic mapping of shared disk

@echo off
net use y: \\192.168.22.80\ Information Department [email protected]/user:it/persistent:yes

rem [email protected] is the password, user:it login is it persistent automatic?


Iv. Restarting IIS

@echo off

net stop Iisadmin/yes
net start IISAdmin
net start w3svc
del/f/s/q%systemdrive%\*.tmp
del/f/s/q%SYSTEMDRIVE%\*._MP
del/f/s/q%systemdrive%\*.gid
del/f/s/q%systemdrive%\*.chk
del/f/s/q%systemdrive%\*.old
del/f/s/q%systemdrive%\recycled\*.*
del/f/s/q%windir%\*.bak
del/f/s/q%windir%\prefetch\*.*
del/f/q%userprofile%\cookies\*.*
del/f/q%userprofile%\recent\*.*
del/f/s/q "%userprofile%\local settings\temporary Internet files\*.*"
del/f/s/q "%USERPROFILE%\Local settings\temp\*.*"
del/f/s/q "%userprofile%\recent\*.*"
Exit


V. Delete files prior to the specified day

@echo off
:: Requires support from the Forfiles command win2003/vista/win7 system
REM Specifies the storage path of the file to be deleted
Set Srcdir=f:\record
REM Specified days
Set daysago=90
REM forfiles/p%srcdir%/s/m */d-%daysago%/C "cmd/c del/f/q/a @path"
forfiles/p%srcdir%/s/m */d-%daysago%/C "cmd/c del/f/q/a @path"
For files/p%srcdir%/m/d-%daysago%/C "If @ISDIR ==true rd/s/q @PATH"
Pause


Windows Utility Scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.