常用windows bash配置脚本工具

1、取得svn上所有文件信息
@echo off
svn list http://172.16.144.101/svn/AutomationTest/trunk > tmp.txt
setlocal enabledelayedexpansion
for /f "delims=" %%i in (tmp.txt) do (
    set a=%%i
    echo,!a!
)
del tmp.txt
pause
2、用当前文件替换目标目录下所有对应的文件
@echo off
set filename="Ctrip.Common.Security.EncryptCard.dll"
set dest="D:\web"
replace %filename% %dest% /s
pause
3、注册dll文件
@ECHO OFF
set dir="C:\Windows\System32"
xcopy CtripData.dll %dir% /C
xcopy WebData.dll %dir% /C
rem start /wait regsvr32 %dir%\CtripData.dll /s --/u代表卸载
start /wait regsvr32 %dir%\CtripData.dll /s
start /wait regsvr32 %dir%\WebData.dll /s
echo "ok!"
pause
4、根据编译日期生成patch
@echo off
Setlocal EnableDelayedExpansion
set source_dist=E:\web
rem set site=www
set dist_dir=D:\patch
rem set source_dir=%source_dist%\%site%
set source_dir=%source_dist%
set m=11
set y=2011
set d=25
set last_date=%m%-%d%-%y%
rem clean old patch
rd /q /s %dist_dir%
md %dist_dir%
rem execute copy
xcopy /y /s /D:%last_date% %source_dir% %dist_dir%
pause
5、在目录中查找某一特征文件名的一类文件并生成patch
@echo off
Setlocal EnableDelayedExpansion
xcopy /y /s D:\web\*database.config D:\bak
xcopy /y /s D:\web\*config*.asp D:\bak
6、利用telnet自动登录windows服务器
需要两个文件,分别是
----telnet.bat
@echo off
start /b telnet
cscript //nologo telnet.vbs
-----telnet.vbs 把想操作的命令写入该文件
set sh=WScript.CreateObject("WScript.Shell")
WScript.Sleep 300
sh.SendKeys "open 192.168.81.92{ENTER}"
WScript.Sleep 300
sh.SendKeys "{ENTER}"
WScript.Sleep 300
sh.SendKeys "sambafeng{ENTER}"
WScript.Sleep 300
sh.SendKeys "123456{ENTER}"
WScript.Sleep 300
sh.SendKeys "dir {ENTER}"
7、利用ftp自动同步更新
---ftp.bat
@echo off
rem author:sambafeng
set FtpFile=E:\ftp.txt
start /wait ftp -v -i -s:"%FtpFile%" > ftp.log
pause
---ftp.txt
open 192.168.81.88 53233
dev
123456
cd "/secure"
send D:/patch/*.bat
bye

你可能感兴趣的:(windows)