Board logo

标题: [文本处理] 求大神帮忙解释下这些代码 [打印本页]

作者: xingwuzhe    时间: 2022-1-9 02:48     标题: 求大神帮忙解释下这些代码

::公用脚本1如果有两个参数,立即执行任务
@echo off
set root=X:\windows\system32
set rootx86=X:\windows
set wait=pecmd wait 1000
if not exist "X:\Program Files\WinXShell.exe" (
set say=%root%\pecmd.exe TEAM TEXT "
set font="L300 T300 R768 B768 $30^|wait 800
set wait=echo ...
set xsay=echo ...
set show=echo ...
set xshow=echo ...
) else (
set say=start "" "X:\Program Files\WinXShell.exe" -ui -jcfg wxsUI\UI_led.zip -text
:::set say=start "" "X:\Program Files\WinXShell.exe" -ui -jcfg wxsUI\UI_led.zip -wait 5 -scroll -top -text
set show=start "" "X:\Program Files\WinXShell.exe" -ui -jcfg wxsUI\UI_show.zip -text
set xsay=start "" "X:\Program Files\WinXShell.exe" -code "QuitWindow(nil,'UI_LED')"
set xshow=start "" "X:\Program Files\WinXShell.exe" -code "QuitWindow(nil,'UI_show')"
set wait=%root%\pecmd.exe wait 800
)
if not "%2" == "" set args1=%1&&set args2=%2&&goto startjob
::公用脚本1结束


::动画化批处理
color b0
set a=51
set b=35
:re
set /a a-=2
set /a b-=2
mode con: cols=%a% lines=%b%
if %a% geq 16 if %b% geq 1 goto re
if defined desktop (
    echo desktop ok!
) else (
set desktop=%USERPROFILE%\desktop
)
::补丁缺少的系统组件
if exist %root%\sysx64.exe start /w "" sysx64.exe
::移动x86文件到windows目录
move /y %root%\*x86.exe %rootx86%
:::创建符号链接,避免32位程序运行不正常
mklink %temp%\cmd.exe x:\windows\system32\cmd.exe
::注册很方便的右键菜单
::if exist %root%\ShowDrives_Gui_x64.exe start "" %root%\ShowDrives_Gui_x64.exe --Reg-All
%root%\pecmd.exe LINK %Desktop%\此电脑,%programfiles%\winxshell.exe,,%root%\ico\winxshell.ico
%root%\pecmd.exe LINK %Desktop%\TightVNC Viewer,"%root%\tightvnc\tvnviewer.exe"
%root%\pecmd.exe LINK %Desktop%\iSCSI 发起程序,%root%\iscsicpl.exe,,%root%\ico\iscsicli.ico
%root%\pecmd.exe LINK %Desktop%\ghostx64,%root%\ghostx64.exe
%root%\pecmd.exe LINK %Desktop%\netcopy网络同传,%root%\netcopyx64.exe
%root%\pecmd.exe LINK %Desktop%\CGI一键还原,%root%\cgix64.exe
%root%\pecmd.exe LINK %Desktop%\BT客户端,%root%\btx64.exe
%root%\pecmd.exe LINK %Desktop%\ImDisk_Gui镜像挂载,%root%\ShowDrives_Gui_x64.exe
::%root%\pecmd.exe LINK %Desktop%\DG分区工具,%root%\DiskGeniusx64.exe
%root%\pecmd.exe LINK %Desktop%\文件共享盘,explorer.exe,B:\
%root%\pecmd.exe LINK %Desktop%\文件共享盘,"%programfiles%\explorer.exe", B:\
%root%\pecmd.exe LINK %Desktop%\文件共享盘,"%windir%\winxshell.exe", B:\
%root%\pecmd.exe LINK %Desktop%\Ghost自动网克,"%root%\startup.bat",netghost,%root%\ico\ghost32.ico
%root%\pecmd.exe LINK %Desktop%\连接共享,"%root%\startup.bat",smbcli,%root%\ico\smbcli.ico
%root%\pecmd.exe LINK %Desktop%\多播接收,"%root%\startup.bat",cloud,%root%\ico\uftpd.ico
%root%\pecmd.exe LINK %Desktop%\多播发送,"%root%\uftp.exe",-R 800000,%root%\ico\uftp.ico
%root%\pecmd.exe LINK %Desktop%\Hou多播发送,"%rootx86%\housx86.exe",E:\system.wim,"%rootx86%\housx86.exe"
%root%\pecmd.exe LINK %Desktop%\Hou多播接收,"%rootx86%\houcx86.exe",I:\,"%rootx86%\houcx86.exe"
%root%\pecmd.exe LINK %Desktop%\伽卡教师端,"%rootx86%\gakax86.exe",,"%rootx86%\gakax86.exe"
%root%\pecmd.exe LINK %Desktop%\伽卡学生端,"%rootx86%\gakax86.exe",student,"%rootx86%\gakax86.exe"
%root%\pecmd.exe LINK %Desktop%\DG分区工具,"%rootx86%\DiskGeniusx86.exe"
::if exist "%programfiles%\winxshell.exe" start "" "%programfiles%\winxshell.exe" -code Desktop:Refresh()
%root%\pecmd.exe kill penetwork.exe
if exist "%SystemDrive%\Program Files\PENetwork\penetwork.reg" reg import "%SystemDrive%\Program Files\PENetwork\penetwork.reg"
if exist "%SystemDrive%\Program Files\PENetwork\penetwork.exe" start "" /min "%SystemDrive%\Program Files\PENetwork\penetwork.exe"

::获得执行的任务名称%job%
for /f "tokens=1-2 delims=@ " %%a in ('dir /b %root%\*@*') do (
set %%a
set %%b
)
if not "%1" == "" set job=%1
echo 服务器IP地址为  %ip%
echo 本次执行的任务  %job%

:::旧的查找ip方式
:::for /f "tokens=2 delims==" %%a in ('dir /b %root%\serverip*') do set ip=%%a
:判断ip值
if defined ip (
    goto runtask
) else (
%say% "提取服务器IP中,检测系统目录下的ip.txt" %font%
if exist X:\windows\system32\ip.txt @echo 文件存在.准备提取...&&goto txtip
if not exist X:\windows\system32\ip.txt @echo 文件不存在.dhcp作为服务器地址...&&goto dhcpip
)

:::检测服务器文件并退出
:runtask
cd /d "%ProgramFiles(x86)%"
echo
cls
%say% "正在初始化网络" %font%
%wait%
%xsay%
::ipconfig /renew>nul


::::::::::::::公用脚本开始::::::::::::::
::::::::::::::检测IP脚本开始::::::::::::::
set n=0
:checkip
%xsay%
::上报本机ip到服务器
for /f "tokens=1,2 delims=:" %%a in ('Ipconfig^|find /i "IPv4 地址 . . . . . . . . . . . . :"') do (
for /f "tokens=1,2 delims= " %%i in ('echo %%b')  do set myip=%%i
)
ipconfig /renew>nul
set /a n=%n%+1
%say% "第%n%(15)次获取IP" %font%
%wait%::循环开始
if not "%myip%" == "" goto getipok
if "%n%" == "15" goto getipbuok
goto checkip
::获取ip成功
:getipok
%xsay%
%xshow%
::显示ip
:::%show% %myip%
%say% "获取IP成功!本机ip:%myip% 上报中......" %font%
%wait%
echo .>%myip%
tftp %ip% put %myip% client/%myip%
%xsay%
%say% "上报完毕!" %font%
%wait%
%xsay%
goto init

::获取IP失败
:getipbuok
%xsay%
%xshow%
%say% "获取IP失败,DHCP服务不常,或没有网卡驱动" %font%
%wait%
%xsay%
::显示ip
::%show% %myip%
goto init
::::::::::::::检测IP脚本结束:::::::::::::
作者: Batcher    时间: 2022-1-9 13:04

回复 1# xingwuzhe


你主要用这个代码实现什么功能?
哪一部分是你看不懂的呢?




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2