>tmp.ini) else (echo %%j|find "被替换内容">nul" />

修改ini文件的批处理与vbs代码


批处理代码:

@echo off >tmp.ini
for /f "tokens=1* delims=:" %%i in ('findstr /n ".*" 文件位置') do (
   if "%%j"=="" (echo.>>tmp.ini) else (
      echo %%j|find "被替换内容">nul&&(
        call set tp=%%j&call echo %%tp:被替换内容=替换内容%%>>tmp.ini)||(
           >>tmp.ini echo %%j)
   )
)
copy tmp.ini 文件位置 /y >nul||(attrib -s -a -r -h 文件位置& copy tmp.ini 文件位置 /y >nul)
del tmp.ini
pause 

用VBS更简单:
vbs代码:

On Error Resume Next 
Dim Fso,TxtFl,Str
Set Fso = CreateObject("Scripting.FileSystemObject")
Set TxtFl = Fso.OpenTextFile ("文件位置",1)
Str = Replace ( TxtFl.ReadAll,"被替换内容","替换内容")
Set TxtFl = Fso.OpenTextFile ("文件位置",2)
TxtFl.Write Str 
TxtFl.Close

批处理打开和关闭文件

关闭 两种命令方法:

taskkill /f im "要关闭的进程名"

ntsd -c q -pn "要关闭进程名"

后者更强一点..~!

打开程序:

start "" “位置/程序名”

查看图片

修改Windows Server 2008 R2 的3389远程端口的Bat批处理代码
功能就是通过批处理实现修win2008r2服务器远程端口为6637并加入到防火墙中@ECHOOFFcolor0AECHO----------------------------------------------------------------------------ECHO.ECH

oracle、mysql数据库停止与启动的批处理文件
1.关机,取消关机::关机echo30秒之后关机%systemroot%system32shutdown-s-t30::取消关机echo取消关机%systemroot%system32shutdown-a2.oralce,或者mysql滴服务启动与关闭::oralce

Windows下bat批处理脚本使用telnet批量检测远程端口小记
多年没写过批处理了,来新公司的第一个case却是需要写一个bat脚本,批量更新采集agent的配置文件,其中就涉及到远程IP的端口检测。本以为会和Linux一