标题: [网络连接] [分享]批处理校园IP共享设置软件 [打印本页]
作者: mxxcgzxxx 时间: 2011-5-30 10:13 标题: [分享]批处理校园IP共享设置软件
两个程序组成,刚写成不久还有待缩水,忘各位大侠帮小弟把关一下
主程序:为读取设置文件生成设置菜单
修改程序:负责修改和重建\备份\还原设置文件.
主程序:- @echo off
- setlocal enabledelayedexpansion
- taskkill /f /im explorer.exe
- start explorer.exe
- title 中小学校校园网IP设置
- MODE con: COLS=80 lines=20
- color e0
-
- echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 中小学校园网络IP设置程序 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ V.1.0 $$$$$$
- echo $$$$$$ 2011-05 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 出品: 黑雨工作室 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 电邮: heimao007@sina.com $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
-
- pause>nul
- echo.
- echo 开始校验文件完整性,请稍候!如果此目录下的文件过多可能会影响速度!
- :前奏
- :: -----------------------------------------------------------------------------------
- :校验原文件
- set file1=computer.ip
- set file2=I级菜单.menu
- set file3=II级菜单.menu
- set file4=工作组.menu
- set file5=网络参数.menu
- set file6=网络权限.menu
- for /l %%1 in (1,1,6) do (
- set yz%%1=0
- for /r %%i in (*.*) do if "%%~nxi"=="!file%%1!" set yz%%1=1
- if "!yz%%1!"=="0" (
- echo 文件不完整,无法进行设置!
- echo 请使用参数修改器还原或修复软件!
- echo 按任意键后退出本软件!
- pause
- )
- )
- :: 读取网络参数,并以W开头函数命名!
- for /f "eol=E tokens=1,3 delims= " %%i in (网络参数.menu) do set w%%i=%%j
- :: 读取工作组参数,并以G开头函数命名!
- for /f "eol=E tokens=1,2 delims= " %%i in (工作组.menu) do set g%%i=%%j
-
- :1
- :: ----------------------------读取一级菜单并输出成选项----------------------------------
- cls
- set "describe="
- echo.
- echo.
- echo.
- set r=1
- for /f "eol=E tokens=1 delims= " %%i in (I级菜单.menu) do (
- echo !r! %%i
- set a!r!=%%i
- set /a r+=1
- )
- echo %r% 退出
- echo.
- echo.
- echo.
- echo.
- set /p p=请选择:
- if %p%==%r% goto :eof
-
- cls
- set r=1
- for /f "eol=E tokens=1-7 delims= " %%1 in (I级菜单.menu) do (
- if "%p%"=="!r!" (
- set menu2=%%1
- set gzz=%%2
- set qx=%%3
- set szfa=%%4
- set qsip=%%5
- set jsip=%%6
- set smwz=%%7
- goto :2
- )
- set /a r+=1
- )
- goto :1
-
- :2
- goto :%szfa%
- echo 此选项未配置设置方案,请联系管理员设置I级菜单!
- pause
- goto:1
-
- :禁止
- :: -------------------------------------------------禁----止-----------------------------
-
- echo.
- echo.
- echo.
- echo.
- echo 配置部门 : %menu2%
- echo.
- echo 配置说明 : %smwz%
- echo.
- echo 设置方案 : %szfa%
- echo.
- echo 起始IP : %wy%%qsip%
- echo 结束IP : %wy%%jsip%
- echo.
- echo.
- echo.
- echo.
- pause
- goto :1
-
- :手动
- :: -----------------------------------------------手----动-------------------------------
-
- cls
- echo.
- echo %menu2%IP设置
- echo.
- echo 备用IP:范围(%wy%%qsip% 至 %jsip% ) ,请输入相应的数字!
- echo.
- echo 需要返回主菜单请输入 00
- echo.
- echo.
- set/p ip=您要设置的备用IP是:
- if "%ip%"=="00" goto :1
- @:: 判断是否在输入区间
- for /l %%i in (%qsip%,1,%jsip%) do if "%ip%"=="%%i" goto :sdmm
- echo.
- echo.
- echo -------------------------------------------
- echo 错误,超出范围!按任意键重新填入.
- echo.
- pause
- goto :手动
-
- :sdmm
- cls
- echo.
- echo.
- echo 输入您想要计算机名!
- echo.
- echo 注意事项:计算机名在网内不可重名,最好以部门职位命令名同时
- echo 如果需要标明是谁用的电脑请在备注内说明!
- echo 名字与备注都不要超过6个中文字或12个英文字!
- echo.
- set /p computername=计算机名:
- if "%computername%"=="" goto :sdmm
- echo.
- set/p describe=备注:
-
- goto :通用配置
-
-
-
- :学生
- :: -----------------------------------------------学-----生------------------------------
-
- cls
-
- title %menu2%IP设置,请选择。
- echo.
- set /a js=%jsip%-%qsip%
- echo 教师机请输入0,学生机输入相应的机号1~%js%
- echo.
- set/p jh=您要设置的机号是:
-
- if "%jh%"=="0" goto :电脑室教师机
-
- @:: 判断是否在输入区间
- for /l %%i in (1,1,%js%) do if "%jh%"=="%%i" goto :szssj
- goto :学生
-
- :szssj
- set/a ip=%jh%+%qsip%
- set computername=%jh%号学生
- set describe=%computername%
- goto :通用配置
-
- :电脑室教师机
- set ip=10
- set computername=电脑室主机
- set describe=%computername%
- set qx=6
- goto :通用配置
-
-
- :菜单
- :: ------------------------------------------------菜-----单-----------------------------
-
- cls
- echo.
- echo.
- echo.
- echo 二级菜单 %menu2%
- set r=1
- echo.
- echo.
- echo.
- for /f "eol=E tokens=1,2 delims= " %%1 in (II级菜单.menu) do (
- if "%menu2%"=="%%1" (
- echo !r! %%2
- set m!r!=%%2
- set /a r+=1
- )
- )
- echo %r% 退出
- echo.
- echo.
- echo.
- echo.
- set /p p=请选择:
- if %p%==%r% goto :1
-
- :cls
- for /f "eol=E tokens=2 delims= " %%1 in (II级菜单.menu) do (
- if "!m%p%!"=="%%1" (
- set menu2=%%1
- goto :直配
- )
- )
- goto :菜单
-
- :直配
- :: -------------------------------------------------直------配---------------------------
-
- cls
- set r=1
- echo.
- echo.
- echo.
- echo 三级菜单 %menu2%
- echo.
- echo.
- echo.
- for /f "eol=E tokens=1,2 delims= " %%1 in (computer.ip) do (
- if "%menu2%"=="%%1" (
- echo !r! %%2
- set m!r!=%%2
- set /a r+=1
- )
- )
- echo %r% 退出
- echo.
- echo.
- echo.
- echo.
- set /p p=请选择:
- if %p%==%r% goto :1
-
- :cls
- for /f "eol=E tokens=2,3,4,5 delims= " %%1 in (computer.ip) do (
- if "!m%p%!"=="%%1" (
- set computername=%%1
- set ip=%%2
- set gzz=%%3
- set qx=%%4
- goto :通用配置
- )
- )
- goto :直配
-
- :通用配置
- :: --------------------------------------------------通--用--配--置----------------------
-
- title 将要修改的信息如下
-
- :: 判断权限
- cls
- if "%describe%"=="" set describe=%menu2%用机
- @echo.
- @echo.
- @echo.
- @echo.
- echo 配置部门 : %menu2%
- @echo.
- @echo 本机名称 : %computername%
- @echo.
- @echo 计算机描述 : %describe%
- @echo.
- @echo 工作组名 : !g%gzz%!
- @echo.
- @echo 网络权限为 : %qx%
- @echo.
- @echo 本 机 I P : %wy%%ip%
- @echo.
- @echo.
- @echo.
- @echo 以上信息是否准确?
- @echo.
- @echo 1、是,可以开始写入 !
- @echo 2、否,我要重新开始选择!
-
-
- set/p p= 您的选择:
-
- echo.
-
- if "%p%"=="1" goto :写入
- if "%p%"=="2" goto :1
- goto :通用配置
-
- :写入
- echo 读取权限
- set "yhmm="
- for /f "eol=E tokens=1-3 delims= " %%1 in (网络权限.menu) do (
- if "%qx%"=="%%1" (
- set wlyh=%%2
- set gxpf=%%3
- )
- )
-
- title 开始修改信息,请稍后...
- @echo 通用IP设置(计算机名、网关、掩码、DNS、工作组)
-
- echo 正在更改计算机名请稍后...... 改名为:%computername%
- echo.
- reg add HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName /v ComputerName /t REG_SZ /d %computername% /f > nul
- reg add HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v ComputerName /t REG_SZ /d %computername% /f > nul
- reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v Hostname /t REG_SZ /d %computername% /f > nul
- reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v "NV Hostname" /t REG_SZ /d %computername% /f > nul
- echo.
-
- pause
- set u
-
- echo 设置网关
- netsh interface ip set address name="本地连接" gateway=%wy%%wg% gwmetric=0
- echo.
- @echo 设置本机IP和掩码
- netsh interface ip set address name="本地连接" source=static addr=%wy%%ip% mask=%wym%
- echo.
-
- @echo 设置主DNS
- netsh interface ip set dns name="本地连接" source=static addr=%wdns%
- echo.
- @echo 设置备用DNS
- netsh interface ip add dns "本地连接" %wbdns%
- @echo.
- echo 开始设置计算机名及工作组, 请稍候.......
- echo 加入工作组 工作组为:!g%gzz%!
- wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="!g%gzz%!"
- echo.
-
-
- @echo 修改计算机描述
-
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\Parameters" /v srvcomment /t reg_sz /d %describe% /f
-
- net config server /SRVCOMMENT:"%describe%"
-
- @echo 开始设置网络映射权限,请稍候
- pause
- cls
- :end
- @echo off
- :: 删除原有映射
- cls
- for %%1 in (I J K L M N O P Q R S T U V W X Y Z) do net use %%1: /delete
-
- cls
- echo.
- echo.
- echo 读取权限
- set "yhmm="&set /p yhmm=请输入"%wlyh%"密码:
- echo 映射网盘
-
- set pfs=0
- for /l %%i in (0,1,23) do (if "!gxpf:~%%i,1!"=="" goto :改盘名)&(set pfm=!gxpf:~%%i,1!)&(for %%1 in (!pfm!) do net use !pfm!: \\%wy%%whwq%\!wp%%1! /user:%wlyh% %yhmm%)&(set pfs=%%i)
- :改盘名
- @echo 磁盘改名
- label c:系统
- label d:软件
- label e:数据
- label f:备份
-
- for /l %%i in (0,1,%pfs%) do (set pfm=!gxpf:~%%i,1!)&(for %%1 in (!pfm!) do reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##%wy%%hwq%#!wp%%1! /v _LabelFromReg /t REG_SZ /d !wp%%1! /f > nul)
-
- @echo 设置完成
- @echo ---------------------------------------退出----------------------------------------------------
- pause
- taskkill /f /im explorer.exe
- start explorer.exe
- :test
复制代码
修改程序:- @echo off
- setlocal enabledelayedexpansion
- MODE con: COLS=100 lines=40
- color e0
- for /l %%1 in (0,1,5) do echo.
- echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 中小学校园网络IP设置配套修改程序 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ V.1.01 $$$$$$
- echo $$$$$$ 2011-05 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 出品: 黑雨工作室 $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ 电邮: heimao007@sina.com $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$ $$$$$$
- echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
-
-
-
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 初始数据区 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
- :序
-
- set "kk= "
- set file1=computer.ip
- set file2=I级菜单.menu
- set file3=II级菜单.menu
- set file4=工作组.menu
- set file5=网络参数.menu
- set file6=网络权限.menu
- set timef=time.dat
- call :校验原文件
- if "%yz%"=="6" goto :前言
- call :校验备份文件
- if "%bak%"=="6" (
- echo 原文件不完整,请使用还原或重建
- pause
- goto :原文件损坏
- )
- echo 文件不完整,请进行设置文档重建!
- pause
- goto :初始设置
-
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :前言
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :测试区
-
-
-
-
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 主菜单程序区 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :正文
- title 中小学校校园局域网IP设置参数修改软件----黑雨工作室
- for /l %%1 in (0,1,2) do echo.
- echo 特别提示: 使用本软件请谨慎行事,如无必要请现在关闭!
- for /l %%1 in (0,1,5) do echo.
- pause>nul
-
- :0
- set p=0
- cls
- for /l %%1 in (0,1,3) do echo.
- echo 1 还原设置文档
- echo.
- echo 2 备份设置文档
- echo.
- echo 3 修改设置文档
- echo.
- echo 4 重建设置文档
- echo.
- echo 5 退出软件
- for /l %%1 in (0,1,3) do echo.
- set /p p= 请选择:
- goto :%p%
- :1
- call :还原
- goto :0
- :2
- call :备份
- goto :0
- :3
- call :修改
- goto :0
- :4
- call :重建
- goto :0
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :还原
- title 正在进行还原……
- cls
- for /l %%1 in (1,1,6) do copy bak%%1.dat !file%%1!
- echo 还原完成
- pause>nul
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :备份
- title 正在进行备份……
- cls
- for /l %%1 in (1,1,6) do copy !file%%1! bak%%1.dat
- echo 备份完成
- pause>nul
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :重建
- title 重建软件系统文档
- set p=0
- cls
- for /l %%1 in (0,1,3) do echo.
- echo 1 快速还原默认初始值
- echo.
- echo 2 手动重建文档
- echo.
- echo 3 退出
- for /l %%1 in (0,1,3) do echo.
- set /p p= 请选择:
- if %p%==1 goto :cj1
- if %p%==2 goto :cj2
- if %p%==3 set p=0&goto :eof
- goto :重建
- :cj1
- for /l %%1 in (1,1,6) do call :file%%1
- call :默认
- echo 已还原成初始值.
- pause>nul
- set p=0&goto :eof
-
- :cj2
- set p=0
- cls
- for /l %%1 in (0,1,3) do echo.
- echo. 手动重建文档方法说明
- echo.
- echo. 手动重建文档将会把所有文档清空,但并不放入初始设置,也就是6个空文件头!
- echo. 六个文件分别为:
- for /l %%1 in (1,1,6) do echo !file%%1!
- echo. 可以在软件目录下找到,使用文本文档打开并按说明要求编辑即可!
- echo.
- echo. 注意:
- echo. 1、由于文本之间的关联性要求您对您的网络设置有个全面的认识!
- echo. 2、如果没有按要求编写有可能会出现错误!
- echo. 3、本操作执行后,只可使用还原功能修复错误,请慎重!
- echo. 4、请先备份原有软件资料!如无把握请使用软件进行修改!
- pause>nul
- for /l %%1 in (0,1,3) do echo.
- set /p p= [1]继续 [2或其它]取消
- if %p%==1 goto :cj21
- set p=0&goto :eof
- :cj21
- for /l %%1 in (1,1,6) do call file%%1
- pause>nul
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :校验原文件
- set yz=0
- for /l %%1 in (1,1,6) do (
- if EXIST !file%%1! (set /a yz+=1) ELSE (echo 文件 !file%%1! 不存在!)
- )
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :校验备份文件
- set bak=0
- for /l %%1 in (1,1,6) do (
- if EXIST bak%%1.dat (set /a bak+=1) ELSE (echo 文件 !file%%1! 备份不存在!)
- )
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :初始设置
- set p=0
- cls
- for /l %%1 in (0,1,3) do echo.
- echo 1 重建文档
- echo 2 退出软件
- for /l %%1 in (0,1,3) do echo.
- set /p p= 请选择
- if %p%==1 call :重建&goto :前言
- pause
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :原文件损坏
- set p=0
- echo 1 还原
- echo 2 重建文档
- echo 3 退出软件
- for /l %%1 in (0,1,3) do echo.
- set /p p= 请选择
- if %p%==1 call :还原&goto :前言
- if %p%==2 call :重建&goto :前言
- pause
- goto :eof
-
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 修改软件主程序区 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
- :修改
- title 手动修改软件参数
- cls
- set p=0
- for /l %%1 in (0,1,3) do echo.
- echo 参数文档修改
- echo.
- echo. 1 修改一级菜单
- echo.
- echo. 2 修改二级菜单
- echo.
- echo. 3 修改具体IP分配
- echo.
- echo. 4 修改工作组参数 (危险)
- echo.
- echo. 5 修改网络权限 (危险)
- echo.
- echo. 6 修改网络参数 (危险)
- echo.
- echo. 7 退 出
- echo.
- set /p p= 请选择:
- if %p%==1 call :f2
- if %p%==2 call :f3
- if %p%==3 call :f1
- if %p%==4 call :f4
- if %p%==5 call :f6
- if %p%==6 call :f5
- if %p%==7 set p=0&goto :eof
- goto :修改
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f1
- title 修改具体IP分配信息
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改软件的IP设置信息,具体参数有:分类、机名、IP、工作组、权限;
- echo.
- echo.2)本设置为主菜单方案为直配、菜单以及二级菜单的分类选项而服务;
- echo.
- echo.3)在设置时应注意格式,如IP为1~254的数字,并且不可以重复使用!
- echo.
- echo.4)要正确使用本设置请先确定已设置好一级、二级菜单、工作组以及网络权限和参数!
- echo.
- pause>nul
- set file=%file1%
- set ne=1
- set qk=0
- call :fun 分类 计算机名 IP 工作组 权限等级
- call :max 18 18 11 16 3 0 0 0
- call :lmx 15 15 3 14 3 0 0 0
- call :min 1 1 1 1 1 0 0 0
- call :auo 2 1 1 3 4 0 0 0
- :look1
- call :查看文件 1 %file% 18
- :p1
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出 请选择:
- if %p%==1 goto :look1
- if %p%==2 goto :newf1
- if %p%==3 goto :editf1
- if %p%==4 call :删除 1 18
- if %p%==5 set p=0&goto :eof
- goto :p1
-
- :newf1
- call :前空 %qk%
- set "dat0=%dat%"
-
- for /l %%z in (1,1,5) do (
- call :edf1%%z
- if "%next%"=="1" set p=0&goto :P1
- )
-
- set "dat=%dat0%%dat1%%dat2%%dat3%%dat4%%dat5%"
- echo.
- echo.E --分类----------计算机名---------IP地址-------工作组---------权限
- echo.%dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf1
- goto :p1
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf1
- cls
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- call :查看文件 1 %file% 18
- echo =======================================
- set /p edit=请输入您需要修改的行号(0 退出):
- if %edit%==0 goto :p1
- echo.
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf11
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf1
-
- :editf11
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf1 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf12
- )
- set /a a+=1
- )
- :editf12
- set p1=0
- echo.
- echo 选择您要修改的那项数据?
- echo [1]%fun1% [2]%fun2% [3]%fun3% [4]%fun4% [5]%fun5% [6]下一步 [7]取消
- set /p p1=请选择:
- if %p1%==6 goto :editf13
- if %p1%==7 goto goto :p1
- for /l %%z in (1,1,5) do if %p1%==%%z (
- call :edf1%%z
- echo.
- echo 修改的情况如下:
- call :lookf1 !dat1! !dat2! !dat3! !dat4! !dat5! !dat6! !dat7! !dat8!
- goto :editf12
- )
- echo 您的选择超出范围!
- pause>nul
- goto goto :editf12
- :editf13
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,5) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!!dat3!!dat4!!dat5!"
- call :edit "!edit!" "!dat!"
- call :替换 1 18
- goto :p1
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :edf11
- call :一级菜单 1
- call :test %dat% %lmx1%
- call :补齐字符数 "%dat%" "%max1%" "%len%"
- set "dat1=%dat%"
- goto :eof
-
- :edf12
- call :输入文字 %fun2% %max2% %lmx2% %min2%
- set "dat2=%dat%"
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- set oldat=%%2
- for %%i in (%dat%) do if "%%i"=="!oldat!" (
- echo 计算机名重复,请重写!
- pause>nul
- goto :edf12
- )
- )
- goto :eof
-
- :edf13
- call :输入文字 %fun3% %max3% %lmx3% %min3%
- set /a ip=%dat%
- for /l %%1 in (1,1,254) do if %ip%==%%1 goto :edf131
- echo IP格式非法,请用1~254的数字!
- pause>nul
- goto :edf13
- :edf131
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do if %ip%==%%3 (
- echo IP重复,请重写!
- pause>nul
- goto :edf13
- )
- set "dat3=%dat%"
- goto :eof
-
- :edf14
- call :工作组
- call :test %dat% %lmx4%
- call :补齐字符数 "%dat%" "%max4%" "%len%"
- set "dat4=%dat%"
- goto :eof
-
- :edf15
- call :权限
- call :test %dat% %lmx5%
- call :补齐字符数 "%dat%" "%max5%" "%len%"
- set "dat5=%dat%"
- goto :eof
-
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f2
- title 修改一级菜单
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改软件的主菜单信息,具体参数有:菜单、默认工作组、默认权限、分配方案、起止IP、说明;
- echo.
- echo.2)本设置的方案有禁止、学生、手动、直配、菜单四种方式,直配和菜单方案均需设置具体分机IP;
- echo.
- echo.3)在设置时应注意格式,如起止IP为1~254的数字,并且不可以重复使用!
- echo.
- echo.4)要正确使用本设置请先确定已设置好工作组以及网络权限和参数!
- echo.
- pause>nul
- set file=%file2%
- set ne=1
- set qk=4
- call :fun 菜单 工作组 权限 配置方案 起IP 终IP 说明
- call :max 18 18 11 16 19 17 100 0
- call :lmx 15 14 3 4 3 3 100 0
- call :min 1 1 1 1 0 1 1 0
- call :auo 1 3 4 5 1 1 1 0
- :look2
- call :查看文件 2 %file% 12
- :p2
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出 请选择:
- if %p%==1 goto :look2
- if %p%==2 goto :newf2
- if %p%==3 goto :editf2
- if %p%==4 call :删除 2 12
- if %p%==5 set p=0&goto :eof
- goto :p2
-
- :newf2
- call :前空 %qk%
- set "dat0=%dat%"
-
- for /l %%z in (1,1,7) do (
- if !d!==1 goto :newf21
- call :edf2%%z
- if "%next%"=="1" set p=0&goto :P2
- )
- :newf21
-
- set "dat=%dat0%%dat1%%dat2%%dat3%%dat4%%dat5%%dat6%%dat7%"
- echo.
- echo.E ---单位-----------默认工作组分类-----默认权限---设置方案-------分配起始IP地址------结束IP地址--------说明
- echo %dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf2
- goto :p2
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf2
- cls
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- call :查看文件 2 %file% 12
- echo =======================================
- set /p edit=请输入您需要修改的行号(0 退出):
- if %edit%==0 goto :p2
- echo.
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf21
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf2
-
- :editf21
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf2 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf22
- )
- set /a a+=1
- )
-
- :editf22
- set p1=0
- echo.
- echo 选择您要修改的那项数据?
- echo [1]%fun1% [2]%fun2% [3]%fun3% [4]%fun4% [5]%fun5% [6]%fun6% [7]%fun7%
- echo [8]下一步 [9]取消
- set /p p1=请选择:
- if %p1%==8 goto :editf23
- if %p1%==9 goto goto :p2
- for /l %%z in (1,1,7) do if %p1%==%%z (
- call :edf2%%z
- echo.
- echo 修改的情况如下:
- call :lookf2 !dat1! !dat2! !dat3! !dat4! !dat5! !dat6! !dat7! !dat8!
- goto :editf22
- )
- echo 您的选择超出范围!
- pause>nul
- goto :editf22
-
- :editf23
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,7) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!!dat3!!dat4!!dat5!!dat6!!dat7!"
- call :edit "!edit!" "!dat!"
- call :替换 2 12
-
-
- goto :p2
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :edf21
- call :输入文字 %fun1% %max1% %lmx1% %min1%
- set "dat1=%dat%"
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- set oldat=%%1
- for %%i in (%dat%) do if "%%i"=="!oldat!" (
- echo 菜单名重复,请重写!
- pause>nul
- goto :edf21
- )
- )
- goto :eof
-
- :edf22
- call :工作组
- call :test %dat% %lmx2%
- call :补齐字符数 "%dat%" "%max2%" "%len%"
- set "dat2=%dat%"
- goto :eof
-
- :edf23
- call :权限
- call :test %dat% %lmx3%
- call :补齐字符数 "%dat%" "%max3%" "%len%"
- set "dat3=%dat%"
- goto :eof
-
- :edf24
- call :方案
- call :test %dat% %lmx4%
- call :补齐字符数 "%dat%" "%max4%" "%len%"
- set "dat4=%dat%"
- goto :eof
-
- :edf25
- set d=0
- call :输入文字 %fun5% %max5% %lmx5% %min5%
- set "dat5=!dat!"
- if "!dat:~0,1!"==" " (
- call :前空 %max6%
- set "dat6=%dat%"
- set "dat7=%dat%"
- set d=1
- goto :eof
- )
- set /a ip=%dat%
- for /l %%1 in (1,1,254) do if %ip%==%%1 goto goto :eof
- echo IP格式非法,请用1~254的数字!
- pause>nul
- goto :edf25
-
- :edf26
- call :输入文字 %fun6% %max6% %lmx6% %min6%
- set "dat6=%dat%"
- set /a ip=%dat%
- for /l %%1 in (1,1,254) do if %ip%==%%1 goto :edf261
- echo IP格式非法,请用1~254的数字!
- pause>nul
- goto :edf26
- :edf261
- if %dat% leq %dat5% (
- echo 错误!小等于起始IP
- echo 起始IP为:%dat5%
- pause>nul
- goto :edf26
- )
- goto :eof
-
-
- :edf27
- call :输入文字 %fun7% %max7% %lmx7% %min7%
- set "dat7=%dat%"
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f3
- title 修改二级菜单
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改软件的二级菜单信息,具体参数有:菜单、分类;
- echo.
- echo.2)本设置的菜单为一级菜单所有项,分类为二级菜单子项;
- echo.
- echo.3)在设置时应注意格式,并且分类名不可以重复使用!
- echo.
- echo.4)要正确使用本设置请先确定已设置好一级菜单!
- echo.
- pause>nul
- set file=%file3%
- set ne=1
- set qk=6
- call :fun 一级菜单 二级菜单
- call :max 13 18 0 0 0 0 0 0
- call :lmx 15 15 0 0 0 0 0 0
- call :min 1 1 0 0 0 0 0 0
- call :auo 2 1 0 0 0 0 0 0
- :look3
- call :查看文件 3 %file% 18
- :p3
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出 请选择:
- if %p%==1 goto :look3
- if %p%==2 goto :newf3
- if %p%==3 goto :editf3
- if %p%==4 call :删除 3 18
- if %p%==5 set p=0&goto :eof
- goto :p3
-
- :newf3
- call :前空 %qk%
- set "dat0=%dat%"
- set next=0
-
- for /l %%z in (1,1,2) do (
- call :edf3%%z
- if "%next%"=="1" set p=0&goto :P3
- )
- set "dat=%dat0%%dat1%%dat2%"
- echo.
- echo.E -----单位--------二级分类------
- echo %dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- for /f %%1 in (%file%) do set a=1
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf3
- goto :p3
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf3
- cls
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- call :查看文件 3 %file% 18
- echo =======================================
- set /p edit=请输入您需要修改的行号(0 退出):
- if %edit%==0 goto :p3
- echo.
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf31
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf3
-
- :editf31
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf3 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf32
- )
- set /a a+=1
- )
-
- :editf32
- set p1=0
- echo.
- echo 选择您要修改的那项数据?
- echo [1]%fun1% [2]%fun2% [3]下一步 [4]取消
- set /p p1=请选择:
- if %p1%==3 goto :editf33
- if %p1%==4 goto goto :p3
- for /l %%z in (1,1,2) do if %p1%==%%z (
- call :edf3%%z
- echo.
- echo 修改的情况如下:
- call :lookf3 !dat1! !dat2! !dat3! !dat4! !dat5! !dat6! !dat7! !dat8!
- goto :editf32
- )
- echo 您的选择超出范围!
- pause>nul
- goto :editf32
-
- :editf33
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,2) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!"
- call :edit "!edit!" "!dat!"
- call :替换 3 12
-
-
- goto :p3
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :edf31
- call :一级菜单 0
- call :test %dat% %lmx1%
- call :补齐字符数 "%dat%" "%max1%" "%len%"
- set "dat1=%dat%"
- goto :eof
-
- :edf32
- call :输入文字 %fun2% %max2% %lmx2% %min2%
- set "dat2=%dat%"
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- set oldat=%%2
- for %%i in (%dat%) do if "%%i"=="!oldat!" (
- echo 菜单名重复,请重写!
- pause>nul
- goto :edf32
- )
- )
- goto :eof
-
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f4
- title 修改工作组信息
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改工作组信息,具体参数有:工作组分类、工作组名;
- echo.
- echo.2)本设置的工作组分类为其他菜单的调用参数,工作组名为实际使用的名字;
- echo.
- echo.3)在设置时应注意格式,工作组分类不可重名,工作组名可以相同!
- echo.
- echo.4)危险!本设置将会影响其他相关设置,最好在其他设置前进行!如您对本软件不太熟悉请不要随意修改参数!
- echo.
- pause>nul
- set file=%file4%
- set ne=1
- set qk=7
- call :fun 工作组类别 工作组名称
- call :max 19 16 0 0 0 0 0 0
- call :lmx 14 14 0 0 0 0 0 0
- call :min 1 1 0 0 0 0 0 0
- call :auo 1 1 0 0 0 0 0 0
- :look4
- call :查看文件 4 %file% 18
- :p4
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出 请选择:
- if %p%==1 goto :look4
- if %p%==2 goto :newf4
- if %p%==3 goto :editf4
- if %p%==4 call :删除 4 18
- if %p%==5 set p=0&goto :eof
- goto :p4
-
- :newf4
- call :前空 %qk%
- set "dat0=%dat%"
-
- for /l %%z in (1,1,2) do (
- call :edf4%%z
- if "%next%"=="1" set p=0&goto :P4
- )
- set "dat=%dat0%%dat1%%dat2%"
- echo.
- echo.E ----工作组分类--------工作组名----
- echo %dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf4
- goto :p4
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf4
-
- cls
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- call :查看文件 4 %file% 18
- echo =======================================
- set /p edit=请输入您需要修改的行号(0 退出):
- if %edit%==0 goto :p4
- echo.
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf41
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf4
-
- :editf41
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf4 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf42
- )
- set /a a+=1
- )
-
- :editf42
- set p1=0
- echo.
- echo 选择您要修改的那项数据?
- echo [1]%fun1% [2]%fun2% [3]下一步 [4]取消
- set /p p1=请选择:
- if %p1%==3 goto :editf43
- if %p1%==4 goto goto :p4
- for /l %%z in (1,1,2) do if %p1%==%%z (
- call :edf4%%z
- echo.
- echo 修改的情况如下:
- call :lookf4 !dat1! !dat2! !dat3! !dat4! !dat5! !dat6! !dat7! !dat8!
- goto :editf42
- )
- echo 您的选择超出范围!
- pause>nul
- goto :editf42
-
- :editf43
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,2) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!"
- call :edit "!edit!" "!dat!"
- call :替换 4 12
-
-
- goto :p4
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :edf41
- call :输入文字 %fun1% %max1% %lmx1% %min1%
- set "dat1=%dat%"
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- set oldat=%%1
- for %%i in (%dat%) do if "%%i"=="!oldat!" (
- echo 工作组类别重复,请重写!
- pause>nul
- goto :edf41
- )
- )
- goto :eof
-
- :edf42
- call :输入文字 %fun2% %max2% %lmx2% %min2%
- set "dat2=%dat%"
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f5
- title 修改初始网络参数信息
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改初始网络参数信息,具体参数有:函数、项目说明、网域IP、网关IP、DNS、备用DNS、服备器IP、服务器共享盘名及映射盘符;
- echo.
- echo.2)本设置的服务器IP和服务器共享盘非必填项目,可放空。同时只有共享盘是可以添加删除的,其他数据都是固定项目;
- echo.
- echo.3)在设置时应注意格式,如网域IP应根据实际情况设置,并省去最后一个节,例网关IP为“192.168.1.1”,网域就只取“192.168.1.”,网关IP取“1”!
- echo.
- echo.4)危险!本设置中的网络共享盘设置将会影响网络权限的相关设置,最好在相关设置前进行修改!如您对本软件不太熟悉请不要随意修改参数!
- echo.
- pause>nul
- set file=%file5%
- set ne=7
- set qk=4
- call :fun 函数名 项目说明 网域 网关 DNS BDNS 服备器 共享盘
- call :max 26 19 12 3 15 15 3 16
- call :lmx 2 7 12 3 15 15 3 16
- call :min 1 1 1 1 1 0 0 0
- call :auo 0 0 1 0 0 0 0 0
- :look5
- call :查看文件 5 %file% 18
- :p5
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出(或直接回车) 请选择:
- if %p%==1 goto :look5
- if %p%==2 goto :newf5
- if %p%==3 goto :editf5
- if %p%==4 call :删除 5 18
- if %p%==5 set p=0&goto :eof
- goto :p5
-
- :newf5
- call :前空 %qk%
- set "dat0=%dat%"
-
- set a=1&set b=1
- for /f "eol=E tokens=1-3 delims= " %%1 in (%file5%) do (
- if !a! geq %ne% (
- set wp=%%1
- set "wp!b!=!wp:~1,1!"
- set /a b+=1
- )
- set /a a+=1
- )
- set /a b-=1
-
- :newf51
- set "wp="
- for /l %%1 in (1,1,%b%) do set "wp=!wp!!wp%%1! "
- echo.
- echo 现有网络映射盘:%wp%,请输入您要创建的新网盘,请不要与现有网盘相同!
- set /p newp=请输入一个h~z的小写字母,00退出:
- if %newp%==00 goto p5
- echo.
- for /l %%1 in (1,1,%b%) do if "%newp%"=="!wp%%1!" (
- echo 盘符已存在!不可重复设置!
- pause>nul
- goto :newf51
- )
- for %%1 in (a b c d e f g) do if "%newp%"=="%%1" (
- echo 您所选的盘符为系统保留盘符,请重选!
- pause>nul
- goto :newf51
- )
- for %%1 in (h i j k l m n o p q r s t u v w x y z) do if "%newp%"=="%%1" goto :newf52
- echo 您的选择不符合规范!或您使用了大写字母!
- pause>nul
- goto :newf51
-
- :newf52
- set "dat=p%newp%"
- call :test %dat% %lmx1% 0
- if %err%==1 goto :newf51
- call :补齐字符数 "%dat%" "%max1%" "%len%"
- set "dat1=%dat%"
-
- set "dat=共享盘%newp%"
- call :test %dat% %lmx2%
- call :补齐字符数 "%dat%" "%max2%" "%len%"
- set "dat2=%dat%"
-
- call :输入文字 %fun8% %max8% %lmx8% %min8%
- set "dat3=%dat%"
-
- set "dat=%dat0%%dat1%%dat2%%dat3%"
- echo.
- echo.E -函数名(软件中前多加w)------项目---------------数据------------------
- echo %dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf5
- goto :p5
-
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf5
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- set "lmxall=12 3 0 15 15 3 16"
- set "minall=1 1 0 1 0 0 0"
- call :查看文件 5 %file% 18
- echo =======================================
- set /p edit=请输入您需要修改的行号(00 退出):
- if %edit%==00 goto :p5
- echo.
- if %edit%==3 (
- echo IP掩码默认设置不可修改
- pause>nul
- goto :editf5
- )
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf51
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf5
-
- :editf51
- if %edit% geq 7 (set lanx=7) ELSE (set lanx=%edit%)
- set a=1
- for %%1 in (%lmxall%) do (
- if !a!==%lanx% set lmx=%%1
- set /a a+=1
- )
- set a=1
- for %%1 in (%minall%) do (
- if !a!==%lanx% set min=%%1
- set /a a+=1
- )
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf6 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf52
- )
- set /a a+=1
- )
-
- :editf52
- call :输入文字 %dat2% %lmx% %lmx% %min%
- set "dat3=%dat%"
- set a=1
- set d=0
- set "wip="
- echo.
- goto :lanx%lanx%
-
- :lanx1
- for /l %%1 in (0,1,%lmx%) do (
- set "t=!dat:~%%1,1!"
- if "!t!"=="." (
- set /a d+=1
- for /l %%i in (0,1,255) do if !wip!==%%i set "wip="&set a=0
- ) ELSE (
- set "wip=!wip!!t!"
- )
- if "!t!"==" " goto lanx11
- if "!t!"=="" goto lanx11
- if !a!==4 (
- echo 格式错误2!IP地不可以超过四位数,并且要在0-255之间!
- pause>nul
- goto :editf52
- )
- set /a a+=1
- )
- :lanx11
- if !d!==3 if "%wip%" lss "." goto :editf53
- echo 格式错误1!段位不足或最后一个点后有数字!
- echo 网域样例:1.1.1.——255.255.255. (不包含最后一个IP地址)
- pause>nul
- goto :editf52
-
- :lanx2
- call :edf52
- if %err%==1 goto :editf52
- goto :editf53
-
- :lanx3
- echo 掩码默认为255.255.255.0
- pause>nul
- goto :editf52
-
- :lanx4
- call :edf51
- if %err%==1 goto :editf52
- goto :editf53
-
- :lanx5
- if "%dat%"=="" goto :editf53
- set a=1
- for %%i in (%dat%) do (
- for /f "eol=E tokens=3 delims= " %%1 in (%file%) do (
- if !a!==4 if "%%1"=="%%i" (
- echo 错误!备用DNS 不可以与主DNS重复!
- echo 主DNS为:%%1
- pause>nul
- goto :editf52
- )
- set /a a+=1
- )
- )
- pause
- call :edf51
- if %err%==1 goto :editf52
- goto :editf53
-
- :lanx6
- call :edf52
- if %err%==1 goto :editf52
- goto :editf53
-
- :lanx7
- if "%dat%"=="" goto :editf53
- for /f "eol=E tokens=1,2,3 delims= " %%1 in (%file%) do (
- if "%dat%"== %%3 (
- echo 错误!共享映射盘名不可重复!
- echo 已有%%2: %%3
- pause>nul
- goto :editf52
- )
- set /a a+=1
- )
-
- :editf53
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,2) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!!dat3!"
- call :edit "!edit!" "!dat!"
- call :替换 5 18
-
-
- goto :p5
- :: --------------------------------------------------------------------------------------------------------------------------
- :edf51
- set err=0
- for /l %%1 in (0,1,%lmx%) do (
- set "t=!dat:~%%1,1!"
- if "!t!"=="." (
- set /a d+=1
- for /l %%i in (0,1,255) do if !wip!==%%i set "wip="&set a=0
- ) ELSE (
- set "wip=!wip!!t!"
- )
- if "!t!"==" " goto :edf511
- if "!t!"=="" goto :edf511
- if !a!==4 (
- echo 格式错误2!IP地不可以超过四位数,并且要在0-255之间!
- set err=1
- pause>nul
- goto :eof
- )
- set /a a+=1
- )
- :edf511
- if !d!==3 goto :edf522
- set err=1
- echo 格式错误1!段位不足!
- echo 网域样例:1.1.1.1——255.255.255.254
- pause>nul
- goto :eof
- :edf52
- set err=0
- for %%1 in (%dat%) do set wip=%%1
- :edf522
- for /l %%i in (1,1,254) do if %%i==%wip% goto :eof
- echo 格式错误3!最后一段IP地址必须在1-254之间!
- set err=1
- pause>nul
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :f6
- title 局域网服务器访问权限信息
- cls
- for /l %%1 in (0,1,3) do echo.
- echo.1)本设置将会修改网络权限信息,具体参数有:等级说明、网络帐号、映射共享盘符、备注;
- echo.
- echo.2)本设置的帐号及盘符均针对网络参数中的服务器IP设置,盘符非必填项目。
- echo.
- echo.3)在设置时应注意格式,如盘符:当有l:m:n:o:p:q:五个盘可共享,权限1需共享L:和M:两个盘,则录入"lm"!
- echo.
- echo.4)危险!本设置中的网络共享盘设置将与网络参数的相关设置一一对应!并且会对主菜单和IP分配设置起到影响作用!如您对本软件不太熟悉请不要随意修改参数!
- echo.
- pause>nul
- set file=%file6%
- set ne=1
- set qk=4
- call :fun 权限等级 服务器帐号 共享盘符 备注
- call :max 18 17 20 100 0 0 0 0
- call :lmx 3 15 18 100 0 0 0 0
- call :min 1 1 0 0 0 0 0 0
- call :auo 1 1 1 1 0 0 0 0
- :look6
- call :查看文件 6 %file% 12
- :p6
- set p=0
- echo.************************************************************************
- set /P p= [1]查看 [2]添加 [3]修改 [4]删除 [5]退出 请选择:
- if %p%==1 goto look6
- if %p%==2 goto :newf6
- if %p%==3 goto :editf6
- if %p%==4 call :删除 6 12
- if %p%==5 set p=0&goto :eof
- goto :p6
-
- :newf6
- call :前空 %qk%
- set "dat0=%dat%"
-
- for /l %%z in (1,1,4) do (
- call :edf6%%z
- if "%next%"=="1" set p=0&goto :P6
- )
- set "dat=%dat0%%dat1%%dat2%%dat3%%dat4%"
- echo.
- echo.E -网络权限等级--------网络帐号--------映射盘符数----------备注----
- echo %dat%
- echo.
- echo.以上数据是否正确?
- set p=0
- set /p p=[1]是,写入。[2]否,重写。[其它]退出。
- if %p%==1 echo.>>%file%&echo %dat%>>%file%
- if %p%==2 goto :newf6
- goto :p6
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :editf6
-
- cls
- set edit=0
- echo 请看清您需要修改的行号,并记下:
- pause>nul
- call :查看文件 6 %file% 18
- echo =======================================
- set /p edit=请输入您需要修改的行号(0 退出):
- if %edit%==0 goto :p6
- echo.
- for /l %%1 in (1,1,%n%) do if %edit%==%%1 goto :editf61
- echo 您所输入的行号不存在!请看清再输入!
- pause>nul
- goto:editf6
-
- :editf61
- set a=1
- set b=%edit%
- for /f "eol=E tokens=1-8 delims= " %%1 in (%file%) do (
- if !a!==%edit% (
- call :lookf6 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- call :dat %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- goto :editf62
- )
- set /a a+=1
- )
-
- :editf62
- set p1=0
- echo.
- echo 选择您要修改的那项数据?
- echo [1]%fun1% [2]%fun2% [3]%fun3% [4]%fun4% [5]下一步 [6]取消
- set /p p1=请选择:
- if %p1%==1 echo 权限等级不可修改,只可以添加!&pause>nul&goto :editf62
- if %p1%==5 goto :editf63
- if %p1%==6 goto goto :p6
- for /l %%z in (2,1,4) do if %p1%==%%z (
- call :edf6%%z
- echo.
- echo 修改的情况如下:
- call :lookf6 !dat1! !dat2! !dat3! !dat4! !dat5! !dat6! !dat7! !dat8!
- goto :editf62
- )
- echo 您的选择超出范围!
- pause>nul
- goto :editf62
-
- :editf63
- call :前空 %qk%
- set "dat0=!dat!"
-
- for /l %%z in (1,1,4) do (
- call :test "!dat%%z!" "!lmx%%z!"
- call :补齐字符数 "!dat%%z!" "!max%%z!" "!len!"
- set "dat%%z=!dat!"
- )
- set "dat=!dat0!!dat1!!dat2!!dat3!!dat4!"
- call :edit "!edit!" "!dat!"
- call :替换 6 12
-
- goto :p6
-
- :: --------------------------------------------------------------------------------------------------------------------------
-
- :edf61
- for /f "eol=E tokens=1 delims= " %%1 in (%file%) do set /a dat=%%1+1
- call :test %dat% %lmx1%
- call :补齐字符数 "%dat%" "%max1%" "%len%"
- set "dat1=%dat%"
- goto :eof
-
- :edf62
- call :输入文字 %fun2% %max2% %lmx2% %min2%
- set "dat2=%dat%"
- goto :eof
-
- :edf63
- set a=1&set b=1
- for /f "eol=E tokens=1-3 delims= " %%1 in (%file5%) do (
- if !a! geq 7 (
- echo !b! %%2 %%3
- set wp=%%1
- set "wp!b!=!wp:~1,1!"
- set /a b+=1
- )
- set /a a+=1
- )
- echo.
- echo.请您输入序号选择您所需要映射的网盘,当需要映射多个网盘时请用空格空开每个选择的数字,
- echo.例:1 2 或 2 3 6。
- set /p wp=
- set "dat="
- for %%1 in (%wp%) do (
- if "!wp%%1!"=="" (
- echo 您选择无效,无此共享!
- pause>nul
- goto :edf63
- )
- set "dat=!dat!!wp%%1!"
- )
- echo %dat%
- pause>nul
- call :test %dat% %lmx3%
- call :补齐字符数 "%dat%" "%max3%" "%len%"
- set "dat3=%dat%"
- goto :eof
-
- :edf64
- call :输入文字 %fun4% %max4% %lmx4% %min4%
- set "dat4=%dat%"
- goto :eof
-
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 通用子程序区 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :file1
- :: 创建 computer.ip
-
- echo E ------ 末级菜单说明 ------------ >computer.ip
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>computer.ip
- echo E 2.计算机名请不要重复,使用空格对准菜单! >>computer.ip
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>computer.ip
- echo E 4.IP地址请不要重复,并与一级菜单二级菜单相对应 >>computer.ip
- echo E 5.以上规则请不要删除,以便再次修改时提供参考. >>computer.ip
- echo.>>computer.ip
- echo E --分类----------计算机名---------IP地址-------工作组---------权限 >>computer.ip
- echo.>>computer.ip
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :file2
- :: 创建 I级菜单.menu
- echo E ------ 一级菜单说明 ------------ >I级菜单.menu
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>I级菜单.menu
- echo E 2.序号请不要重复,使用空格对准菜单! >>I级菜单.menu
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>I级菜单.menu
- echo E 4.设置方法:分为:手动(手动设置IP及机名);菜单(使用二级菜单读取设置);直配(直接读取IP文件进行分配)禁止(不分配区域);学生(学生机自动编号) >>I级菜单.menu
- echo E 5.网络教室,默认第一个IP为教师机并且权限等级为6,第二个IP开始为学生机1号,以此类推;学生机权限为2. >>I级菜单.menu
- echo E 6.禁止\学生\手动 需要给出IP起止数.禁止的可以给出说明,但只许一句话. >>I级菜单.menu
- echo E 7.IP地址不可重叠 >>I级菜单.menu
- echo E 8.以上规则请不要删除,以便再次修改时提供参考. >>I级菜单.menu
- echo.>>I级菜单.menu
- echo E ---单位-----------默认工作组分类-----默认权限---设置方案-------分配起始IP地址------结束IP地址--------说明 >>I级菜单.menu
- echo.>>I级菜单.menu
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :file3
- :: 创建 II级菜单.menu
- echo E ------ 一级菜单说明 ------------ >II级菜单.menu
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>II级菜单.menu
- echo E 2.序号请不要重复,使用空格对准菜单! >>II级菜单.menu
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>II级菜单.menu
- echo E 4.以上规则请不要删除,以便再次修改时提供参考. >>II级菜单.menu
- echo.>>II级菜单.menu
- echo E -----单位--------二级分类------ >>II级菜单.menu
- echo.>>II级菜单.menu
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :file4
- :: 创建 工作组.menu
- echo E ------ 工作组菜单说明 ------------ >工作组.menu
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>工作组.menu
- echo E 2.序号请不要重复,使用空格对准菜单! >>工作组.menu
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>工作组.menu
- echo E 4.请与您别的文档中的工作组分类一一对应,否则会影响使用! >>工作组.menu
- echo E 5.以上规则请不要删除,以便再次修改时提供参考. >>工作组.menu
- echo.>>工作组.menu
- echo E ----工作组分类--------工作组名---- >>工作组.menu
- echo.>>工作组.menu
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :file5
- :: 创建 网络参数.menu
- echo E ------ 菜单说明 ------------ >网络参数.menu
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>网络参数.menu
- echo E 2.请不要更改此菜单的目录项,只可更改后边的数据,并按格式要求填写! >>网络参数.menu
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>网络参数.menu
- echo E 5.共享盘为服务器共享盘名,可以按顺序添加,并在权限那里使用字母选择! >>网络参数.menu
- echo E 6.以上规则请不要删除,以便再次修改时提供参考. >>网络参数.menu
- echo.>>网络参数.menu
- echo E -函数名(软件中前多加w)------项目---------------数据------------------ >>网络参数.menu
- echo.>>网络参数.menu
- goto :eof
-
- :: --------------------------------------------------------------------------------------------------------------------------
- :file6
- :: 创建 网络权限.menu
- echo E ------ 工作组菜单说明 ------------ >网络权限.menu
- echo E 1.使用E开头的行和空行将被文件忽略读取, >>网络权限.menu
- echo E 2.序号请不要重复,使用空格对准菜单! >>网络权限.menu
- echo E 3.完整的名字内请不要使用空格,否则软件将会视为两个内容! >>网络权限.menu
- echo E 4.请与您别的文档中的网络权限等级一一对应,否则会影响使用! >>网络权限.menu
- echo E 5.映射盘符数请用"/"隔开,不要使用空格! >>网络权限.menu
- echo E 6.以上规则请不要删除,以便再次修改时提供参考. >>网络权限.menu
- echo.>>网络权限.menu
- echo E -网络权限等级--------网络帐号--------映射盘符数----------备注---- >>网络权限.menu
- echo.>>网络权限.menu
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :默认
- echo 专用IP 学区办公 1 禁止 11 20 财物等专用IP,请管理员设置! >>I级菜单.menu
- echo 网络教室1 电脑室 1 学生 21 80 网络教室专用地址,会自动分配! >>I级菜单.menu
- echo 行政办公 学区办公 1 手动 81 100 行政办公使用端口。 >>I级菜单.menu
- echo 中心校 中小教师 1 手动 101 200 中心校教师、教室等使用端口。 >>I级菜单.menu
- echo 幼儿园 幼儿办公 1 手动 200 250 附属幼儿园办公及教室使用端口。 >>I级菜单.menu
- echo 特殊IP 无 1 禁止 2 10 特殊设备专用端口,请咨询管理员! >>I级菜单.menu
- echo 临时备用IP 中小教师 1 手动 251 254 临时IP,请用完后自行删除! >>I级菜单.menu
- echo.>>I级菜单.menu
-
- echo 学区办公 MSHOME >>工作组.menu
- echo 电脑室 DNS >>工作组.menu
- echo 中小教师 MSHOME >>工作组.menu
- echo 幼儿办公 MSHOME >>工作组.menu
- echo.>>工作组.menu
-
- echo 1 中小备课组 学校教师机用 >>网络权限.menu
- echo.>>网络权限.menu
-
- echo. y 网域 192.168.1. >>网络参数.menu
- echo. g 网关地址 1 >>网络参数.menu
- echo. ym 掩码 255.255.255.0 >>网络参数.menu
- echo.>>网络参数.menu
- echo. dns 主DNS 218.85.152.99 >>网络参数.menu
- echo. bdns 备用DNS 218.85.157.99 >>网络参数.menu
- echo.>>网络参数.menu
- echo. hwq 服务器IP地址 >>网络参数.menu
- echo.>>网络参数.menu
- echo. pl 共享盘l >>网络参数.menu
- echo. pm 共享盘m >>网络参数.menu
- echo. pn 共享盘n >>网络参数.menu
- echo. po 共享盘o >>网络参数.menu
- echo. pp 共享盘p >>网络参数.menu
- echo. pq 共享盘q >>网络参数.menu
- echo.>>网络参数.menu
-
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :查看文件
- cls
- set a=0&set b=1
- for /f "eol=E tokens=1-8 delims= " %%1 in (%2) do (
- if !a!==%3 (
- set a=0
- pause>nul
- cls
- )
- call :lookf%1 %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8
- echo.
- set /a a+=1
- set /a b+=1
- )
- set /a n=b-1
- goto :eof
-
- :lookf1
- echo !b! 分类:%1 计算机名:%2 IP:%3 工作组:%4 权限等级:%5
-
- goto :eof
-
- :lookf2
- echo !b! 菜单:%1 工作组:%2 权限:%3 配置方案:%4 起止IP:%5~%6
- echo 备注:%7
-
- goto :eof
-
- :lookf3
- echo !b! 一级菜单:%1 二级菜单:%2
-
- goto :eof
-
- :lookf4
- echo !b! 工作组类别:%1 工作组名称:%2
-
- goto :eof
-
- :lookf5
- echo !b! 函数名:%1 项目说明:%2 参数:%3
-
- goto :eof
-
- :lookf6
- echo !b! 权限等级:%1 服务器帐号:%2 共享盘符:%3
- echo 备注:%4
-
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :输入文字
- cls
- set "dat="
- echo 请输入%3字节以内的数据,请不要使用空格!
- echo 中文将计算为两个字节数!
- if %4==1 echo 本数据不得输入空字符!
- if %4==0 echo 本数据可以为空!
- echo.
- set /p dat=输入"%1"数值:
- if %4==1 (
- if "%dat%"=="" (
- echo 不许为空!
- pause
- goto :输入文字
- )
- )
- call :test "%dat%" "%3" "%4"
- if %err%==1 pause&goto :输入文字
- call :补齐字符数 "%dat%" "%2" "%len%"
- goto :eof
-
- :补齐字符数
- set kkg=0
- set "dat=%~1"
- if "%~2"=="%~3" goto :eof
- set /a kkg=%~2-%~3
- for /l %%x in (1,1,%kkg%) do set "dat=!dat!%kk%"
- goto :eof
-
- :test
- set "var=%~1"
- set len=0
- set err=0
- if "%~1"=="" goto :eof
- for /l %%x in (0 1 200) do (
- set "var_=!var:~%%x,1!"
- if "!var_!"=="" goto :eof
- if "%~3"=="0" if "!var_!"==" " (
- echo 错误:字符中带有空格!
- set err=1
- goto :eof
- )
- if !var_! gtr Z (set /a len+=2) else set /a len+=1
- )
- if !len! gtr %~2 (
- echo 错误:已超出规定长度!
- set err=1
- )
- goto :eof
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :前空
- set "dat="
- if %1==0 goto :eof
- for /l %%1 in (1,1,%1) do set "dat=!dat!%kk%"
- goto :eof
-
- :一级菜单
- echo.
- echo 选择分类(一级菜单)
- set p2=0
- set r=1
- set next=0
- for /f "eol=E tokens=1,4 delims= " %%1 in (%file2%) do (
- if "%%2"=="直配" (
- echo !r! %%1 %%2
- set mune!r!=%%1
- set cd!r!=0
- set /a r+=1
- )
- if "%%2"=="菜单" (
- echo !r! %%1 %%2
- set mune!r!=%%1
- set cd!r!=1
- set /a r+=1
- )
- )
- echo.
- set /a r-=1
- if %r%==0 echo 无可用菜单选项,只有分配方式被设为“菜单”或“直配”的菜单才可进行设置!& set next=1&goto :eof
- set /p p2=请选择(00退出):
- if %p2%==00 set next=1&goto eof
- for /l %%1 in (1,1,%r%) do if %p2%==%%1 (
- set dat=!mune%p2%!
- if "!cd%p2%!"=="1" (
- if %1==1 call :二级菜单 !dat!
- )
- goto :eof
- )
-
- goto :一级菜单
-
- :二级菜单
- echo.
- echo 选择分类(二级菜单)
- set p3=0
- set r=1
- for /f "eol=E tokens=1,2 delims= " %%i in (%file3%) do (
- if "%%i"=="%1" (
- echo !r! %%j
- set mune!r!=%%j
- set /a r+=1
- )
- )
- echo.
- set /a r-=1
- if %r%==0 echo 无可用菜单选项!
- set /p p3=请选择(00退出):
- if %p3%==00 set next=1&goto eof
- for /l %%i in (1,1,%r%) do if %p3%==%%i (
- set dat=!mune%p3%!
- goto :eof
- )
- goto :二级菜单
-
- :工作组
- echo.
- echo 选择工作组
- set p1=0
- set r=1
- for /f "eol=E tokens=1 delims= " %%1 in (%file4%) do (
- echo !r! %%1
- set mune!r!=%%1
- set cd!r!=0
- set /a r+=1
- )
- echo.
- set /a r-=1
- set /p p1=请选择(00退出):
- if %p1%==00 set next=1&goto eof
- for /l %%1 in (1,1,%r%) do if %p1%==%%1 (
- set dat=!mune%p1%!
- goto :eof
- )
- goto :工作组
-
- :权限
- echo.
- echo 选择网络权限
- set p1=0
- set r=1
- for /f "eol=E tokens=1,2 delims= " %%1 in (%file6%) do (
- echo !r! 等级:%%1 帐号:%%2
- set mune!r!=%%1
- set cd!r!=0
- set /a r+=1
- )
- echo.
- set /a r-=1
- set /p p1=请选择(00退出):
- if %p1%==00 set next=1&goto eof
- for /l %%1 in (1,1,%r%) do if %p1%==%%1 (
- set dat=!mune%p1%!
- goto :eof
- )
- goto :权限
-
-
- :方案
- echo.
- echo 选择分配方案
- echo. 1 禁止:禁止非管理员分配IP
- echo. 2 菜单:通过二级菜单分配IP
- echo. 3 直配:一级菜单直接分配IP
- echo. 4 手动:手动分配IP
- echo. 5 学生:网络教室自动分配IP,第一个地址默认教师机,其余学生机!
- echo.
- set /p p1=请选择(00退出):
- if %p1%==00 set next=1&goto eof
- if %p1%==1 set dat=禁止&set min5=1&goto :eof
- if %p1%==2 set dat=菜单&goto :eof
- if %p1%==3 set dat=直配&goto :eof
- if %p1%==4 set dat=手动&set min5=1&goto :eof
- if %p1%==5 set dat=学生&set min5=1&goto :eof
- goto :方案
-
- :: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- :删除
- set t=0
- set p1=0
- set /P p1= 请输入(%ne%~%n%)需要删除的行号,输入“0”重新查看。请选择:
- if %p1%==0 goto :look1
- set a=0&set b=1
- for /l %%1 in (%ne%,1,%n%) do (
- if %p1%==%%1 (
- call :edit "%p1%" ""
- set t=1
- goto :替换
- )
- )
- echo.
- echo. 您的选择无效!请重新选择。
- goto :删除
-
- :替换
- call :查看文件 %1 %timef% %2
- set p1=0
- echo.===============================================
- echo.是否确认修改?
- set /p p1=[1]确认 [2或其他]取消 请选择:
- if !p1!==1 goto :确认修改
- pause>nul
- goto :eof
-
- :确认修改
- cls
- echo.
- echo. 确认修改将会对文档进行不可修复的操作!请慎重,如果你现在后悔还来得及!
- pause>nul
- call :file%1
- for /f "delims=" %%z in (%timef%) do echo.%%z>>%file%
- echo 已进行修改!如果您之前有做过备份还可以进行还原!
- goto :eof
-
-
- :edit
- echo.>%timef%
- set e=1
- set "new=%~2"
- for /f "eol=E delims=" %%x in (%file%) do (
- set "newdat=%%x"
- if !e!==%~1 set "newdat=%new%"
- echo.!newdat!>>%timef%
- set /a e+=1
- if "%%x"=="" set /a e-=1
- if "%%x"==" " set /a e-=1
- )
- goto :eof
-
-
-
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 数据写入区 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :fun
- set fun1=%1
- set fun2=%2
- set fun3=%3
- set fun4=%4
- set fun5=%5
- set fun6=%6
- set fun7=%7
- set fun8=%8
- goto :eof
-
- :max
- set max1=%1
- set max2=%2
- set max3=%3
- set max4=%4
- set max5=%5
- set max6=%6
- set max7=%7
- set max8=%8
- goto :eof
-
- :lmx
- set lmx1=%1
- set lmx2=%2
- set lmx3=%3
- set lmx4=%4
- set lmx5=%5
- set lmx6=%6
- set lmx7=%7
- set lmx8=%8
- goto :eof
-
- :min
- set min1=%1
- set min2=%2
- set min3=%3
- set min4=%4
- set min5=%5
- set min6=%6
- set min7=%7
- set min8=%8
- goto :eof
-
- :auo
- set auo1=%1
- set auo2=%2
- set auo3=%3
- set auo4=%4
- set auo5=%5
- set auo6=%6
- set auo7=%7
- set auo8=%8
- goto :eof
-
- :dat
- set dat1=%1
- set dat2=%2
- set dat3=%3
- set dat4=%4
- set dat5=%5
- set dat6=%6
- set dat7=%7
- set dat8=%8
- goto :eof
复制代码
作者: applba 时间: 2011-5-30 11:20
是我见过第二长的p代码,曾经见过5000行的p代码。
作者: batman 时间: 2011-5-30 11:25
同感太长了。。。
作者: CrLf 时间: 2011-5-30 13:33
楼主的干劲值得鼓励,但是可以精简的地方太多了...
建议达到更高水平之后回头优化一下。
作者: mxxcgzxxx 时间: 2011-5-30 14:04
是啊我也是感觉太长了,去一些装饰语言还是有一千多行.所有类别分成了6个设置文档
一级菜单\二级菜单\工作组\具体IP\总参数\服务器权限
所以修改时每个文档的方法不同,困挠哈.
作者: Hello123World 时间: 2011-5-30 15:38
让我想起了——1898戊戌变法……
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |