RTX中自定义群组 BAT批处理模式修改自定义内容

以下为BAT文件,可以随意为客户端增加自定义群组,只要运行即可。

文件注释中有些,只要修改里面替换后的内容即可



请复制一下内容保存为BAT文件即可

============================BAT开始==============================


@echo off
rem 指定待搜索的文件
setlocal enabledelayedexpansion


set username=
set /p username=  请输入OA登录名:
set "FileName=UserDefinedGroup.xml"


echo 请勿关闭窗口,正在处理,预计需要5-10分钟,请稍候...
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
  if exist %%a:\ (
    for /f "delims=" %%b in ('dir /a-d /s /b "%%a:\*%FileName%" 2^>nul') do (
      if /i "%%~nxb" equ "%FileName%" (
   echo %%b
echo %%b|findstr /m "%username%">>temp.txt
      )
    )
  )
)




for /f "delims=" %%i in ('findstr /n .* temp.txt') do (
set "var=%%i"
set var=!var:*:=!
set /a j+=1
if !j! EQU 1 set "Mstr1=!var!"
if !j! EQU 2 set "Mstr2=!var!"
if !j! EQU 3 set "Mstr3=!var!"
if !j! EQU 4 set "Mstr4=!var!"
if !j! EQU 5 set "Mstr5=!var!"
)


rem  replaced 为需要替换的文件   all为替换后的文件  特殊符号需要处理
set replaced=^</Group^>^</Groups^>
set all=^<Group id="60000105" name="管理人员"^>^<USER NICK="zhangwei"/^>^<USER NICK="gaoyong"/^>^<USER NICK="shenyi"/^>^<USER NICK="wangna"/^>^<USER NICK="bushengdong"/^>^</Group^>^<Group id="60000106" name="综合组"^>^<USER NICK="lijiapu"/^>^<USER NICK="baiyan"/^>^<USER NICK="sunlvmengzhu"/^>^<USER NICK="hezijie"/^>^<USER NICK="liuxincai"/^>^<USER NICK="chenglizhe"/^>^<USER NICK="sunhao"/^>^</Group^>^<Group id="60000107" name="计划营销组"^>^<USER NICK="tuwenhao"/^>^<USER NICK="liang"/^>^<USER NICK="liuzhaoxiang"/^>^<USER NICK="zhangxianfeng"/^>^<USER NICK="liuzhihui"/^>^<USER NICK="fengdaqing"/^>^<USER NICK="pankuifan"/^>^<USER NICK="liujianmao"/^>^<USER NICK="lihongzhan"/^>^<USER NICK="chenjie1"/^>^<USER NICK="zengwei"/^>^</Group^>^<Group id="60000108" name="财务成本组"^>^<USER NICK="zhangxinying"/^>^<USER NICK="guoxin"/^>^<USER NICK="daizhenzhong"/^>^<USER NICK="xuguoliang"/^>^<USER NICK="xujian"/^>^<USER NICK="wangmeng2"/^>^<USER NICK="liuzhiliang"/^>^<USER NICK="liuyandan"/^>^<USER NICK="lichangtao"/^>^<USER NICK="duyuan"/^>^</Group^>^<Group id="60000109" name="基础设施组"^>^<USER NICK="wangliuming"/^>^<USER NICK="jiangli1"/^>^<USER NICK="chenxuewen"/^>^<USER NICK="hanyuliang"/^>^<USER NICK="zhangchun"/^>^<USER NICK="zhaozhenying"/^>^<USER NICK="suzhiyong"/^>^<USER NICK="huanglezhao"/^>^</Group^>^</Group^>^</Groups^>


if exist !Mstr1! (
set file=!Mstr1!
set "file=!file:"=!"
for %%i in ("!file!") do set file=%%~fi
echo !file!




for /f "delims=" %%i in ('type "!file!"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"!file!"_tmp.txt
)


 copy "!file!" "!file!"_bak.txt >nul 2>nul
 move "!file!"_tmp.txt "!file!"


)


echo 线程1处理完毕


if exist !Mstr2! (


set file=!Mstr2!
set "file=!file:"=!"
for %%i in ("!file!") do set file=%%~fi
echo !file!




for /f "delims=" %%i in ('type "!file!"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"!file!"_tmp.txt
)


 copy "!file!" "!file!"_bak.txt >nul 2>nul
 move "!file!"_tmp.txt "!file!"
 
)


echo 线程2处理完毕


if exist !Mstr3! (
set file=!Mstr3!
set "file=!file:"=!"
for %%i in ("!file!") do set file=%%~fi
echo !file!




for /f "delims=" %%i in ('type "!file!"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"!file!"_tmp.txt
)


 copy "!file!" "!file!"_bak.txt >nul 2>nul
 move "!file!"_tmp.txt "!file!"
)


echo 线程3处理完毕


if exist !Mstr4! (
set file=!Mstr4!
set "file=!file:"=!"
for %%i in ("!file!") do set file=%%~fi
echo !file!




for /f "delims=" %%i in ('type "!file!"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"!file!"_tmp.txt
)


 copy "!file!" "!file!"_bak.txt >nul 2>nul
 move "!file!"_tmp.txt "!file!"
)


echo 线程4处理完毕


if exist !Mstr5! (
set file=!Mstr5!
set "file=!file:"=!"
for %%i in ("!file!") do set file=%%~fi
echo !file!




for /f "delims=" %%i in ('type "!file!"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"!file!"_tmp.txt
)


 copy "!file!" "!file!"_bak.txt >nul 2>nul
 move "!file!"_tmp.txt "!file!"
)


echo 线程5处理完毕

pause



========================BAT结束==============================

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值