windows實用指令碼

來源:互聯網
上載者:User

標籤:bat常用指令碼工具

整理下日常windows上用的比較多幾個命令工具指令碼。

一、刪除目錄及目錄下的所有檔案

@echo on
cd  /D E:\test
for /R  %%s in (.,*) do  rd /q /s %%s\建立檔案夾
exit


rem  刪除一個目錄下的所有指定的檔案夾


二、自動壓縮後刪除

@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


三、自動對應共用盤

@echo off
net use y: \\192.168.22.80\資訊部 [email protected] /user:it /persistent:yes

rem   [email protected]是密碼,user:it  登入名稱是it    persistent自動的?


四、重啟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


五、刪除指定天以前的檔案

@echo off
::需要Win2003/Vista/Win7系統內建的forfiles命令的支援
rem 指定待刪除檔案的存放路徑
set SrcDir=F:\RECORD
rem 指定天數
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實用指令碼

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.