注册 | 登录

游侠NETSHOW论坛





查看: 1813|回复: 2
打印 上一主题 下一主题

[原创] 网吧用户自动更新游戏 [复制链接]

帖子
204
精华
0
积分
102
金钱
323
荣誉
0
人气
1
评议
0
跳转到指定楼层
楼主
发表于 2009-10-28 14:01:21 |只看该作者 |倒序浏览
客户机 开机启动 updata3.bat
  [updata3.bat]
  @call \\dianying2\游戏\更新纪录\updata3.bat
  
  [updata3.bat]
  @echo off
  if exist ipconfig.txt del ipconfig.txt
  ipconfig /all >ipconfig.txt
  if exist phyaddr.txt del phyaddr.txt
  find "Physical Address" ipconfig.txt >phyaddr.txt
  if exist ipaddr.txt del ipaddr.txt
  find "IP Address" ipconfig.txt >ipaddr.txt
  for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set strMac=%%M
   @echo %strMac%
  for /f "skip=2 tokens=15" %%I in (ipaddr.txt) do set IPAddress=%%I
  @echo %IPAddress%
  arp -d >nul
  arp -s %IPAddress% %strMac% >nul
  ARP -s xxx.xxx.xxx.1 00-3C-01-xx-xx-xx >nul
  ::绑ip
  start/W C:\WINDOWS\system32\worfiv.cpl
  ::狼牙借口
  call \\dianying2\游戏\更新纪录\123\判断.bat
  exit
  
  
   [判断.bat]
  for /f "" %%N IN (\\dianying2\useru$\123456\Config.ini) Do if %ComputerName%==%%N (
  call \\dianying2\游戏\更新纪录\123\分配.bat
   ) Else (
  echo 123
  )
  ::主要为了看这台机器用不用更新
  
  
  [分配.bat]
  for /f "tokens=*" %%i in (a.txt) do (set /a "str=%%i")
   set /A a=%str%+1
  set /A b=%str% %%2
  echo %a% > a.txt
   echo %b%
  @if "%b%"=="1" goto mbmbpd
  @if "%b%"=="0" goto dianying2pd
  :mbmbpd
  call \\mbmb\游戏\更新纪录\123\判断连接.bat
  exit
  :dianying2pd
  call \\dianying2\游戏\更新纪录\123\判断连接.bat
  exit
   ::为了分配到dianying2 或者mbmb
  
  [连接判断.bat] (2个连接判断是一样的,就是位置不同)
  @echo off
  set /A x=0
  :oo
  for /f "tokens=*" %%i in (\\dianying2\useru$\123456\1.ini) do (set /a "str=%%i")
  for /f "tokens=*" %%i in (\\dianying2\useru$\123456\2.ini) do (set /a "str1=%%i")
  set /A x=x+1
  set /A a=%str%
  set /A b=%str1%
  set /A c=a-b
  if %c% GEQ 3 goto pau
  if %c% LEQ 3 goto go
   :pau
  cls
  echo.
  echo =================================
  echo 第 %x% 次等待 连接数目到达最大
  echo 8秒钟后尝试再次连接
  echo dianying2队列 请稍后...
  echo =================================
  @echo %ComputerName% 第 %x% 次等待 连接数目到达最大>> \\dianying2\useru$\123456\报告\等待报告.txt
  @echo dianying2纪录 %time% , %date% >> \\dianying2\useru$\123456\报告\等待报告.txt
  @echo. >> \\dianying2\useru$\123456\报告\等待报告.txt
  ping -n 13 localhost > nul
  goto oo
  :go
  for /f "tokens=*" %%i in (\\dianying2\useru$\123456\1.ini) do (set /a "str2=%%i")
  set /A a=%str%+1
  echo %a% > \\dianying2\useru$\123456\1.ini
  call \\dianying2\游戏\更新纪录\123\更新.bat
  exit
  
  
  [更新.bat]
  
  @xcopy /s /z /d /y/e/h \\dianying2\游戏\网络游戏\传奇世界 D:\网络游戏\传奇世界 >nul
  ...
  rd /s/q d:\网络游戏\浩方对战平台
  start /w \\dianying2\游戏\浩方\浩方对战平台.exe
  for /f "tokens=*" %%i in (\\dianying2\useru$\123456\2.ini) do (set /a "str2=%%i")
  set /A a=%str2%+1
  echo %a% > \\dianying2\useru$\123456\2.in
   Quote:
  for /f "skip=1 tokens=1-2 delims=:" %%a in ('ipconfig /all^|find "IP Address"') do @set IPAddress=%%b
  for /f "skip=1 tokens=1-2 delims=:" %%a in ('ipconfig /all^|find "Physical"') do @set strMac=%%b
  arp -d >nul
  arp -s %IPAddress% %strMac% >nul
  ARP -s xxx.xxx.xxx.1 00-3C-01-xx-xx-xx >nul
  start/W C:\WINDOWS\system32\worfiv.cpl
  find "%ComputerName%" \\dianying2\useru$\123456\Config.ini>nul||goto :分配
  exit
  
  
  :分配
  for /f "tokens=*" %%i in (\\dianying2\游戏\更新纪录\123\a.txt) do (set /a "str=%%i")
  set /A a=%str%+1
  set /A b=%str% %%2
  echo %a% > a.txt
  echo %b%
  @if "%b%"=="1" set updatepath=\\mbmb
  @if "%b%"=="0" set updatepath=\\dianying2
  
  
  :检测
  for /f "tokens=1-2" %%a in ('dir %updatepath%\useru$\123456\*.txt^|find "文件"') do @echo 有%%a台主机正在更新
   if %%a LEQ 3 goto :更新
  set /A x=x+1
  cls
  echo =================================
  echo 第 %x% 次等待 连接数目到达最大
  echo 8秒钟后尝试再次连接
  echo dianying2队列 请稍后...
  echo =================================
  @echo %ComputerName% 第 %x% 次等待 连接数目到达最大>> %updatepath%\useru$\123456\报告\等待报告.txt
  @echo %updatepath%纪录 %time% , %date% >> %updatepath%\useru$\123456\报告\等待报告.txt
  @echo. >> %updatepath%\useru$\123456\报告\等待报告.txt
  ping -n 13 localhost > nul
  goto :检测
  
  
  :更新
  echo .>%updatepath%\useru$\123456\%computername%.txt
  @xcopy /s /z /d /y/e/h %updatepath%\游戏\网络游戏\传奇世界 D:\网络游戏\传奇世界 >nul
  ...
  rd /s/q d:\网络游戏\浩方对战平台
  start /w %updatepath%\游戏\浩方\浩方对战平台.exe
  del %updatepath%\useru$\123456\%computername%.txt
  exit
  
  
  
  绑定IP->分配->检测txt文件个数(如果<3进行更新)->更新(先写一个%computername%.txt,更新完再删掉,方便查看哪几个主机在更新)

使用道具 举报

帖子
204
精华
0
积分
102
金钱
323
荣誉
0
人气
1
评议
0
沙发
发表于 2009-10-28 14:03:01 |只看该作者
参考着记忆写的 以前好像有过类似的东东 我记得不清楚
需要大量的改进  我就喜欢去网吧(在家我老豆玩CS 我碰不到电脑)
带着移动硬盘去网吧 ~ 配置低也不怕

使用道具 举报

帖子
173
精华
0
积分
87
金钱
418
荣誉
0
人气
3
评议
0
板凳
发表于 2009-10-28 14:31:54 |只看该作者
意思楼主是自己想出来的哦,有点厉害,就看了第一段用IPCONFIG命令取IP配置,很不错哦

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

手机版|Archiver|游侠NETSHOW论坛 ( 苏ICP备2023007791号 )

GMT+8, 2025-11-1 01:59 , Processed in 0.312452 second(s), 12 queries , Gzip On, Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

分享到