Get the App
SLTechnology News&Howtos  ›  Servers  › 

Windows utility script

Shulou Source: shulou.com Published: 2022-06-02 19:22:38 10月01日 Update

Sort out a few more command tool scripts used on daily windows.

Delete the directory and all files under the directory

@ echo on cd / D E:\ test for / R%% s in (., *) do rd / Q / s% s% s\ New folder exit

Rem deletes all specified folders in a directory

Delete after automatic compression

The system needs to install rar compression software

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

3. Automatically map shared disk

@ echo off

Net use y:\\ 192.168.22.80\ Information Department it@mxq1993 / user:it / persistent:yes

Rem it@mxq1993 is the password, user:it login name is it persistent automatic?

4. Restart 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

Delete files before the specified day

@ echo off:: need the support of the forfiles command that comes with the Win2003/Vista/Win7 system to specify the storage path of the file to be deleted set SrcDir=F:\ RECORD rem specify the number of 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

6. Automatically set ip address

@ echo offnetsh interface ip set address name= "Local connection" source=static addr=192.168.0.118 mask=255.255.255.0 gateway=192.168.0.1 1netsh interface ip set dns name= "Local connection" source=static addr=202.96.128.86

7. Add routes

But when your windows has multiple network cards and all have the same large network segment, such as 192.168.1.x 192.168.10.x 192.168.20.x

Only 192.168.1.1 is the ip segment that can access the Internet at the exit, so you need to manually set your default gateway as follows:

Route add 192.168.0.0 mask 255.255.0.0 192.168.1.1-p

Tags: Files directories commands folders systems network segments scripts only addresses days passwords tools manual gateways network cards information paths routing software usage Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Xiaomi vpn Shulou Technology