![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-10 03:29 |
共 47,811 主题排行 / 349,897 发帖 / 今日 2 篇 / 48,255 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » [求助]帮助读懂该批处理代码的设计思路? |
| 可打印版本 938 / 2 |
| 第1楼 tempuser | 发表于 2008-10-21 09:56 |
| 高级用户 发帖 261 积分 547 | |
|
[求助]帮助读懂该批处理代码的设计思路? 通常我作为一个初学者编写一个批处理的思路:先设计菜单,在通过goto去实现一个个具体的菜单功能再返回到主菜单上,这样感觉读批处理代码简单易懂,但看高手写的代码却不是这样的,如下面一段公孙轩辕写的代码,感觉很好,但没有读懂思路总是断,麻烦大家能把他的代码给我分析一下他的写作思路好吗,最好能分段分析每段的功能和为什么这么些呢?除了个人的习惯外是不是有更多的代码执行效率方面的考虑呢?
以下是代码: @mode con cols=105 lines=40&color 1f @echo off setlocal EnableDelayedExpansion title 多功能批处理 MADE by 公孙轩辕 QQ:327828994 if not "%1"=="" color 1f&mode con cols=100 lines=40&echo 正在开始每日自动删除系统垃圾!&ping/n 3 127.1 >nul&call %1 for /l %%i in (0,1,15) do echo\ echo\ echo 程序准备中…… call :zb :input cls title 多功能批处理 MADE by 公孙轩辕 QQ:327828994 for /l %%i in (0,1,15) do echo\ echo\ echo 菜单准备中…… call :caidan echo\&echo\&echo\ echo 请输入功能代号: echo\ set sel= set/p sel= if "%sel%"=="" goto input call :cl cls call :%sel% if errorlevel 1 cls&msg * 输入错误的命令,想忽悠在下?&goto input :use call :select "IP Address" "ip" call :select "DNS Servers" "dns" call :select "Subnet Mask" "subnet" call :select "Default Gateway" "gateway" call :select "Physical Address" "phyaddr" call :select "Dhcp Enabled" "dhcp" goto :eof :fo for /f "skip=1 tokens=* delims= " %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( echo %%i echo %%i >>%file%\system.txt ) goto :eof :select ipconfig/all >%systemdrive%\progra~1\XuanYuan\ip.txt for /f "tokens=2 delims=:" %%i in ('findstr /i /c:%1 %systemdrive%\progra~1\XuanYuan\ip.txt') do set "%~2=%%i" goto :eof :sudu ping -n 3 %1 >%systemdrive%\progra~1\XuanYuan\ping.txt for /f "tokens=3,6,9 delims=, " %%i in ('find /i "mini" %systemdrive%\progra~1\XuanYuan\ping.txt') do ( set min=%%i set max=%%j set ave=%%k set min=!min:~0,-2! set max=!max:~0,-2! set ave=!ave:~0,-3! echo 最小延迟 :!min! 毫秒 echo 最大延迟 :!max! 毫秒 echo 平均延迟 :!ave! 毫秒 if !ave! leq 80 echo 连接速度 ………… 优&goto :eof if !ave! leq 150 echo 连接速度 ………… 良&goto :eof if !ave! leq 250 echo 连接速度 ………… 中&goto :eof if !ave! gtr 250 echo 连接速度 ………… 差&goto :eof echo\) goto :eof :lost for /f "tokens=11 delims= " %%i in ('find /i "lost" %systemdrive%\progra~1\XuanYuan\ping.txt') do ( set lo=%%i set lo=!lo:~1!) echo 丢包率 : %lo% goto :eof :qc for /l %%i in (1,1,100) do set/p=<nul for /l %%i in (1,1,100) do set/p= <nul echo\&echo\ >>%file%\system.txt goto :eof :1 echo 获取网络信息…… call :use cls set dhcp2=%dhcp:Yes=是% set dhcp2=%dhcp2:No=否% echo 自动获得IP:%dhcp2% echo 当前IP:%ip% echo 当前DNS:%dns% echo 网关:%gateway% echo 子网掩码:%subnet% ping 127.1>nul call :cl goto input :2 echo\&echo\ echo 程序正在分析…… cls call :select "Dhcp Enabled" "dhcp" if "%dhcp%"==" Yes" (goto guding) else (goto dhcp) :guding title 设置静态IP echo 准备中…… call :use cls @echo 正在设置静态IP地址…… netsh interface Ip set address "本地连接" source=static %ip% %subnet% %gateway% 1 >nul @echo 静态IP地址设置成功,现在设置DNS地址…… Netsh interface IP set dns "本地连接" source=static %dns% both >nul @echo DNS设置成功! call :cl call :1 :dhcp call :cl cls title 设置动态IP @echo 开始设置动态IP地址…… NETSH INTERFACE ip set address "本地连接" source=dhcp >nul @echo 设置动态IP地址成功!现在设置DNS…… NETSH INTERFACE ip set dns "本地连接" source=dhcp >nul @echo 动态DNS地址设置成功! call :1 :3 title QQ临时聊天 echo 请输入对方QQ号码: echo\ set/p QQ= start tencent://message/?uin=%QQ% call :cl goto input :4 schtasks /query|find "每日" >nul if errorlevel 1 echo 第一次使用需输入密码,无密码请直接按Enter键&echo\&echo (注意:输入错误的密码可能导致无法在正常时间运行)&goto not if errorlevel 0 goto have :not echo call %windir%\everybat.bat :4 >%windir%\every.bat SCHTASKS /create /ru %username% /st 22:00:00 /sc daily /tr %windir%\every.bat /tn 每日自动删除垃圾 :have echo/&echo/ echo/ echo/ echo ~正在删除COOKIES~~ del /f /s /q "%userprofile%\cookies\*.*" echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo ~正在删除Temporary Internet Files~ del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" rd /s /q "%userprofile%\Local Settings\Temporary Internet Files" & md "%userprofile%\Local Settings\Temporary Internet Files" echo/&echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo ~正在删除IE TEMP~ del /f /s /q "%userprofile%\Local Settings\Temp\*.*" title 正在删除IE TEMP echo/&echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo ~正在删除Windows TEMP~ del /f /s /q "%windir%\Temp\*.*" echo/&echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo ~正在删除WINDOWS Prefetch~ del /f /s /q "%windir%\Prefetch\*.*" echo/&echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo ~正在删除Downloaded Program Files~ title 正在删除Downloaded Program Files rd /q /s "%windir%\Downloaded Program Files" &md "%windir%\Downloaded Program Files" echo/&echo/ echo/ echo ~删除完成~ ping -n 2 127.1 >nul echo/&echo/ echo/ echo/ echo/&echo/ echo/ echo/ echo ~正在清理缓存~ SFC /PURGECACHE echo/&echo/ echo/ echo/ echo/&echo/ echo/ echo/&echo/ ~清理系统缓存完成~ ping -n 2 127.1>nul echo/&echo/ echo 已完成所有任务! call :cl goto input :5 call :cl cls title 清理磁盘 cleanmgr call :cl goto input :6 for /f "skip=1 tokens=1,2 delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do ( set drive=%%i set drive=!drive:~-2! echo 正在检查!drive!磁盘 title 正在检查!drive!磁盘 echo\&echo\ chkdsk !drive! /v ) ping -n 2 127.1>nul call :cl goto input :7 title 定时关机 echo\&echo\ echo 分析中…… at|find "shutdown" >nul if errorlevel 1 (goto shutadd) else (goto shutdel) :shutadd cls echo 当前时间:%date%,%time% echo\&echo 请输入定时关机时间。(需24小时制,如23:30 ":"为英文标点。) set tim= set/p tim= at %tim% /INTERACTIVE shutdown -s -t 10 >nul echo %tim% >%systemdrive%\progra~1\XuanYuan\shutdown.txt if errorlevel 1 msg * 输入错误,请重新输入!&goto 7 echo 设置成功! ping -n 2 127.1>nul call :cl goto input :shutdel cls echo\&echo\ for /f "tokens=*" %%i in (%systemdrive%\progra~1\XuanYuan\shutdown.txt) do (set shuttime=%%i) for /f "tokens=1" %%i in ('at^|find "shutdown"') do at %%i /del echo 删除在%shuttime%的定时关机成功! call :cl goto input :8 title 网速检测 echo 检查是否连接互联网…… ping -n 2 www.baidu.com>nul if errorlevel 1 msg * 互联网连接不通,无法检测! &goto input if errorlevel 0 echo 已连接互联网,开始检测……&ping -n 1 127.1>nul cls echo 正在检测与中国电信的连接速度……&echo\ call :sudu www.chinatelecom.com.cn set dx=%ave% call :lost echo 正在检测与中国网通的连接速度……&echo\ call :sudu www.chinanetcom.com.cn set wt=%ave% call :lost echo 正在检测与百度的连接速度……&echo\ call :sudu www.baidu.com set bd=%ave% call :lost echo 正在检测与腾讯的连接速度……&echo\ call :sudu www.qq.com set qq=%ave% call :lost echo 正在检测与网易的连接速度……&echo\ call :sudu www.163.com set wy=%ave% call :lost set /a ave1=(%dx%+%wt%+%bd%+%qq%+%wy%)/5 echo\&echo\ echo 总体平均速度 :%ave1% 毫秒 echo\&echo\ if %ave1% leq 80 echo 总体连接速度 ………… 优&goto textfinished if %ave1% leq 150 echo 总体连接速度 ………… 良&goto textfinished if %ave1% leq 250 echo 总体连接速度 ………… 中&goto textfinished if %ave1% gtr 250 echo 总体连接速度 ………… 差&goto textfinished :textfinished echo\ echo 检测完成! ping 127.1>nul call :cl goto input :9 title 查看系统详细信息 echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt set/p=正在加载BISO信息……<nul wmic bios get name,VERSION,Manufacturer >%systemdrive%\progra~1\XuanYuan\tempaa.txt for /f "tokens=1,2,3,6,7,9,10,11 skip=1 delims= " %%i in ('TYPE %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( call :qc echo BISO信息: echo BISO信息: >%file%\system.txt echo\&echo\ >>%file%\system.txt echo BIOS生产商 :%%i %%j %%k echo BIOS生产日期:%%l echo BIOS生产时间:%%m echo BIOS版本: %%o%%p %%n echo BIOS生产商 :%%i %%j %%k >>%file%\system.txt echo BIOS生产日期:%%l >>%file%\system.txt echo BIOS生产时间:%%m >>%file%\system.txt echo BIOS版本: %%o%%p %%n >>%file%\system.txt ) set/p=正在加载CD-Rom信息……<nul wmic cdrom get name,id,Manufacturer >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo CD-Rom 信息 : echo CD-Rom 信息 : >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 盘符 类型 名称 echo 盘符 类型 名称 >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo\ >>%file%\system.txt for /f "skip=1 tokens=1,2,3 delims= " %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( echo %%i %%j echo %%i %%j >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo\ >>%file%\system.txt ) set/p=正在加载系统管理信息……<nul wmic computersystem get name,username,domain >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 系统管理信息: echo 系统管理信息:>>%file%\system.txt echo\&echo\ >>%file%\system.txt for /f "skip=1 tokens=1,2,3 delims= " %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( echo 主机名: %%j echo 当前用户: %%k echo 登陆域: %%i echo 主机名: %%j >>%file%\system.txt echo 当前用户: %%k >>%file%\system.txt echo 登陆域: %%i >>%file%\system.txt ) set/p=正在加载处理器信息……<nul wmic cpu get Name,Version,DeviceID,MaxClockSpeed >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 处理器信息: echo 处理器信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo ID 频率(MHZ) 名称 版本 echo ID 频率(MHZ) 名称 版本 >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载用户桌面信息……<nul wmic desktop get Name,ScreenSaverExecutable,ScreenSaverTimeout >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 桌面信息: echo 桌面信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 用户 屏保地址 屏保等待时间(秒) echo 用户 屏保地址 屏保等待时间(秒) >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载显示器信息……<nul wmic desktopmonitor get Caption,MonitorManufacturer,PixelsPerXLogicalInch,ScreenHeight,ScreenWidth >%systemdrive%\progra~1\XuanYuan\tempaa.txt call:qc echo 显示器信息: echo 显示器信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 名称 类型 大小(dpi) 高像素 宽像素 echo 名称 类型 大小(dpi) 高像素 宽像素 >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载硬盘信息……<nul wmic DISKDRIVE get Caption,Manufacturer, Size >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 硬盘信息: echo 硬盘信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 名称 型号 大小(KB) echo 名称 型号 大小(KB) >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载磁盘分区信息……<nul wmic LOGICALDISK get Caption,Description,FileSystem,FreeSpace,Size,VolumeName >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 磁盘分区信息: echo 磁盘分区信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 分区 类型 格式 剩余大小(KB) 总大小(KB) 标卷 echo 分区 类型 格式 剩余大小(KB) 总大小(KB) 标卷 >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载系统信息……<nul wmic OS get Caption,CSDVersion,TotalVirtualMemorySize,TotalVisibleMemorySize >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 系统信息: echo 系统信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 系统 版本 物理内存(KB) 虚拟内存(KB) echo 系统 版本 物理内存(KB) 虚拟内存(KB) >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt call :fo set/p=正在加载共享信息……<nul wmic SHARE get Caption, Name,Path >%systemdrive%\progra~1\XuanYuan\tempaa.txt call :qc echo 共享信息: echo 共享信息: >>%file%\system.txt echo\&echo\ >>%file%\system.txt echo 项目 名称 路径 echo 项目 名称 路径 >>%file%\system.txt echo\&echo\ >>%file%\system.txt&echo\ >>%file%\system.txt for /f "skip=1 tokens=1,* delims= " %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( echo %%i %%j echo %%i %%j >>%file%\system.txt ) pause del /f %systemdrive%\progra~1\XuanYuan\tempaa.txt >nul start %file%\system.txt goto input :10 title 系统优化 @echo 加快搜索网上邻居的速度 @reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace /f @echo 去掉右键“新建”中的RTF @reg delete HKEY_CLASSES_ROOT\.rtf /v ShellNew /f @echo 加速开机时间 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\" /v "SystemStartOptions" /t reg_sz /d NODETECT /f @echo 卸载无用DLL @reg add "HKEY_LOCAL_MACHINE\SOFTWARE\MicrosoftWindowsCurrentVersion\explorer\" /v "AlwaysUnloadDLL" /t REG_DWORD /d 1 /f @echo 禁止更改主页设置 @reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel" /v "HomePage" /t reg_DWORD /d 00000001 /f @echo 取消快捷方式的箭头 @reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "Link" /t reg_binary /d 00 00 00 00 /f @echo 关闭华医生 @reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug" /v "AUTO" /t reg_sz /d 0 /f @echo 加速程序运行 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v "ConfigFileAllocSize" /t reg_dword /d 000001f4 /f @echo 关闭错误报告 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ERSvc" /v "Start" /t reg_dword /d 00000003 /f @echo 关闭WEBCLINT服务 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient" /v "Start" /t reg_dword /d 00000003 /f @echo 硬件优化 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Vxd\BIOS" /v "CPUPriority" /t reg_dword /d 00000001 /f @echo 停止磁盘空间不足警告 @reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer" /v "NoLowDiskSpaceChecks" /t reg_dword /d 00000001 /f @echo 关闭TIME服务 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time" /v "Start" /t reg_dword /d 00000004 /f @echo 禁止自动打开默认共享 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanServer\parameters" /v "AutoShareServer" /t reg_dword /d 00000000 /f @echo 禁止自动共享 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanServer\parameters" /v "AutoShareWks" /t reg_dword /d 00000000 /f @echo 关闭XP漫游 @reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Applets\Tour" /v "RunCount" /t reg_dword /d 00000000 /f @reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Tour" /v "RunCount" /t reg_dword /d 00000000 /f @echo 关闭XP信使服务 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Messenger" /v "Start" /t reg_dword /d 00000004 /f @echo 关闭光盘自动运行 @reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t reg_multi_sz /d 91,00,00,00 /f @echo 关闭自动重启 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl" /v "AutoReboot" /t reg_dword /d 00000000 /f @echo 加速屏幕刷新率 @reg add "HKEY_LOCAL_MACHINE\ystem\CurrentControlSet\Control\Update\" /v "UpdateMode" /t reg_sz /d 0 /f @echo 加速窗口显示 @reg add "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics" /v "MinAniMate" /t reg_sz /d 0 /f @echo 禁止启动时自动弹出错误信息 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows" /v "NoPopUpsOnBoot" /t reg_sz /d 1 /f @echo 系统启动失败不写入系统日志 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CrashControl" /v "LogEvent" /t reg_dword /d 00000000 /f @echo 不发送管理警报 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl" /v "SendAlert" /t reg_dword /d 00000000 /f @echo 禁止远程修改注册表 @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg" /v "RemoteRegAccess" /t reg_dword /d 00000001 /f @echo 未知文件直接选择打开方式 @reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system" /v "NoInternetOpenWith" /t reg_dword /d 00000001 /f @echo 始终显示扩展名 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 00000000 /f @echo 禁止保留文档记录 @REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V NORECENTDOCSHISTORY /T REG_DWORD /D 1 /F @echo 关闭桌面清理向导 @reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\CleanupWiz" /v "NoRun" /t reg_dword /d 00000001 /f @echo 开启小键盘 @reg add "HKEY_USERS\.DEFAULT\Control Panel\Keyboard" /v "InitialKeyboardIndicators" /t reg_sz /d 2 /f @echo 在系统属性里显示更多CPU信息 @reg add "HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0 " /v "VendorIdentifier" /t reg_sz /d "Genuine Intel" /f @echo 把IE的起始页面改为空白页 @reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\Main " /v "Start page" /t reg_sz /d about:blank /f @echo 扩充回收站右键功能 @reg add "HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\ShellFolder" /v "Attributes" /t reg_dword /d 10 01 00 20 /f @echo CD四倍加速 @reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem\CDFS" /v "Prefetch" /t reg_dword /d 00000004 /f @echo 快速关机 @reg add "HKEY_LOCAL_MACHINE\System\CourrentControlSet\Control\Shutdown" /v "FastReboot" /t reg_sz /d 1 /f echo 解锁注册表 @reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v DisableRegistryTools /t reg_dword /d 00000000 /f @echo 关闭XP自带ZIP支持 regsvr32 /u /s zipfldr.dll echo ………………………………OK! @echo 关闭非法光机后的硬盘扫描 chkntfs /t:0 echo ………………………………OK! @echo 关闭远程连接的默认共享 @net share IPC$ /del echo\ echo\ echo 优化完成! call :cl goto input :11 title 显示局域网共享资源 for /f "tokens=1 delims=\\" %%i in ('net view^|find "\\"') do ( echo %%i >>%systemdrive%\progra~1\XuanYuan\share.txt net view %%i net view %%i>>%systemdrive%\progra~1\XuanYuan\share.txt ) call :cl start %systemdrive%\progra~1\XuanYuan\share.txt goto input :12 rundll32.exe user32.dll,LockWorkStation goto input :13 echo 进程 路径 >%systemdrive%\progra~1\XuanYuan\tempa.txt for /l %%i in (0,1,15) do echo\ echo 正在获取中…… wmic process get Caption,CommandLine >%systemdrive%\progra~1\XuanYuan\tempaa.txt for /f "tokens=* skip=1" %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( if not "%%i"=="" ( echo %%i >>%systemdrive%\progra~1\XuanYuan\tempa.txt) ) call :cl start %systemdrive%\progra~1\XuanYuan\tempa.txt goto input :14 echo\&echo\ echo 分析中…… reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon >nul if "%errorlevel%"=="0" cls & goto dellogin cls for /l %%i in (1,1,5) do echo\ set/p= 正在获取用户信息<nul wmic useraccount get name >%systemdrive%\progra~1\XuanYuan\tempaa.txt for /l %%i in (1,1,100) do set/p=<nul for /l %%i in (1,1,100) do set/p= <nul echo\ set a=0 echo ID 帐户名称 for /f "skip=1" %%i in ('type %systemdrive%\progra~1\XuanYuan\tempaa.txt') do ( set /a a=!!a!+1! set b!a!=%%i echo\ echo !a! %%i) echo\ echo 请输入自动登录的用户对应的 ID: :usererror set/p= <nul set/p id= for /l %%i in (1,1,%a%) do ( if "!id!"=="%%i" ( set id2=!b%%i! )) if "%id2%"=="" echo 不存在该ID,请重新输入:&goto usererror echo\&echo\ echo 请输入%id2%自动登录的密码,无密码请留空: echo set/p= <nul set /p pass= if "%pass%"=="" set pass=空&goto nopass reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /t reg_sz /d %pass% /f >nul :nopass reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /t reg_sz /d no /f >nul reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /f >nul reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /t reg_sz /d 1 /f >nul reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /t reg_sz /d %id2% /f >nul echo\&echo\ echo 添加成功!自动登录用户为: %id2% 自动登录密码为: %pass% set id2= set pass= set id= set a= set b= for /l %%i in (1,1,3000) do ver>nul call :cl goto input :dellogin reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /f >nul echo\&echo\&echo 删除成功! call :cl goto input :15 cls echo\&echo\&echo\ echo ◎功能表◎ echo\&echo\ echo ========================================================== echo $ $ echo $ 1=替换指定文字 2=为文件每行前添加行号 $ echo $ $ echo $ 3=查找含有指定文字行数 4=删除文本中的空行 $ echo $ $ echo $ 5=返回主菜单 $ echo ========================================================== echo\&echo\&echo\ echo 请输入功能代号: echo\ set sel= set/p sel= if "%sel%"=="" goto 15 call :txt%sel% if errorlevel 1 cls&msg * 输入错误的命令,想忽悠在下?&goto 15 :txt1 set wenben= set bth= set thw= set ju= set xju= ::替换指定文字 echo\&echo\&echo\ :txt1input echo 请输入要替换文本的路径或将文件拖入。 echo\ set /p wenben= call :wenben if "%old%"=="" goto txt1input cd /d "%lj%" :txt1bth echo\ echo 请输入要被替换的文字: echo\ set /p bth= if "%bth%"=="" goto txt1bth :txt1thw echo 替换为: echo\ set /p thw= set newwenben=!m!!thw!替换!bth!!x! for /f "tokens=*" %%i in (%m%%x%) do ( set ju=%%i set "xju=!ju:%bth%=%thw%!" call :txtpan ) echo\&echo\&echo 完成!按任意键返回…… pause>nul goto 15 :txtpan if "%ju%"=="" echo\ >>!newwenben! & goto :eof if "%xju%"=="" echo\ >>!newwenben! & goto :eof echo %xju%>>!newwenben! goto :eof :txt2 set hanghao= set wenben= echo\&echo\&echo\ :txt2input echo 请输入要添加行号文件的路径或将文件拖入。 echo\ set /p wenben= call :wenben if "%old%"=="" goto txt2input cd /d "%lj%" set xwenben=!m!行号!x! for /f "tokens=*" %%i in (%m%%x%) do ( set ju=%%i set /a hanghao=!hanghao!+1 echo !hanghao!. !ju!>>!xwenben!) echo\&echo\&echo 完成!按任意键返回…… pause>nul goto 15 :txt3 set wenzi= set gs= set wenben= echo\&echo\&echo\ :txt3input echo 请输入要查找的文件路径或将文件拖入。 echo\ set /p wenben= call :wenben if "%old%"=="" goto txt3input cd /d "%lj%" :wenziinput echo\ echo 请输入要查找到文字: echo\ set/p wenzi= if "%wenzi%"=="" goto :wenziinput for /f "tokens=*" %%i in ('find "%wenzi%" %m%%x%') do ( set ju=%%i set/a gs=!gs!+1) msg * 查找到共有!gs!行包含%wenzi% goto 15 :txt4 set hang= set wenben= set xwenben= set ju= echo\&echo\&echo\ :txt4input echo 请输入要删除空行文件路径或将文件拖入。 echo\ set /p wenben= call :wenben if "%old%"=="" goto txt4input cd /d "%lj%" set xwenben=!m!去除空行!x! for /f "tokens=*" %%i in (%m%%x%) do ( set ju=%%i call :txt4pan ) echo\&echo\&echo 完成!按任意键返回…… pause>nul goto 15 :txt4pan if "%ju%"=="" echo\>>!xwenben! & goto :eof echo !ju!>>!xwenben! goto :eof :txt5 goto input :wenben set old= for /f "tokens=*" %%i in ("%wenben%") do ( set m=%%~ni set x=%%~xi set lj=%%~dpi set old=%%~fi) goto :eof :16 echo\&echo\&echo\&echo\&echo\ set/p= <nul @for /l %%b in (0,1,32) do ( @set ",=★多功能批处理由公孙轩辕制作,QQ:327828994。欢迎使用!" set/p=!,:~%%b,1!<nul set/p= ★<nul for /l %%l in (1,1,600) do ver>nul set/p=<nul) for /l %%l in (1,1,1500) do ver>nul echo\ echo\&echo\&echo\&echo\&echo\ set/p= <nul for /l %%i in (0,1,14) do ( set ",=获取本产品更多信息,请到 : " set/p=!,:~%%i,1!<nul for /l %%l in (1,1,600) do ver>nul ) for /l %%a in (0,1,29) do ( set,=http://hi.baidu.com/huajinghua set/p=!,:~%%a,1!<nul for /l %%a in (1,1,500) do ver>nul ) for /l %%a in (1,1,5000) do ver>nul for /l %%i in (0,1,3) do ( for /l %%a in (0,1,29) do set/p=<nul for /l %%a in (1,1,2000) do ver>nul for /l %%a in (0,1,29) do set/p= <nul for /l %%a in (1,1,2000) do ver>nul for /l %%a in (0,1,29) do set/p=<nul set/p=http://hi.baidu.com/huajinghua<nul ) for /l %%i in (0,1,2) do ( for /l %%a in (0,1,29) do ( set/p=<nul set/p= <nul set/p=<nul for /l %%i in (1,1,100) do ver>nul) for /l %%i in (0,1,29) do ( set,=http://hi.baidu.com/huajinghua call set/p=!,:~%%i,1!<nul for /l %%a in (1,1,500) do ver>nul )) for /l %%i in (0,1,2) do ( for /l %%a in (0,1,29) do set/p=<nul for /l %%i in (0,1,29) do ( set/p= http://hi.baidu.com/huajinghua<nul for /l %%a in (1,1,600) do ver>nul for /l %%a in (0,1,29) do set/p=<nul ) for /l %%i in (0,1,30) do ( set/p=http://hi.baidu.com/huajinghua <nul for /l %%a in (1,1,600) do ver>nul for /l %%a in (0,1,31) do set/p=<nul ) set/p= http://hi.baidu.com/huajinghua<nul ) echo\&echo\&echo\&echo\&echo\ set/p= 按任意键返回主菜单<nul pause >nul goto input :17 start mailto:327828994@qq.com goto input :caidan set/a xc=%random%%%6+1 set te= for %%i in (a b f e d c) do ( set /a te=!!te!+1! if "!xc!"=="!te!" set xc=%%i) color 1%xc% call :select "Dhcp Enabled" "dhcp" if "%dhcp%"==" Yes" (set "ipk=固定IP地址") else (set "ipk=获取动态IP") at|find "shutdown" >nul if errorlevel 1 (set shut=开启自动关机) else (set shut=删除自动关机) reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon >nul if "%errorlevel%"=="1" set logon=设置用户自动登录XP if "%errorlevel%"=="0" set logon=删除用户自动登陆XP cls echo\&echo\&echo\&echo\&echo 多功能批处理 MADE BY 公孙轩辕 QQ:327828994 echo\&echo\&echo ◎ 菜单 ◎ &echo\ echo ====================================================================== echo $ $ echo $ 1=查看本地连接详细信息 2=%ipk% $ echo $ $ echo $ 3=发起QQ临时会话 4=每日定时清理系统垃圾 $ echo $ $ echo $ 5=清理磁盘 6=检查硬盘错误 $ echo $ $ echo $ 7=%shut% 8=网速测试 $ echo $ $ echo $ 9=查看电脑详细信息 10=常用系统优化 $ echo $ $ echo $ 11=显示局域网上的所有共享资源 12=锁定计算机 $ echo $ $ echo $ 13=查看系统进程及路径 14=%logon% $ echo $ $ echo $ 15=常见文本处理 16=产品动画广告 $ echo $ $ echo $ 17=给作者提意见 $ echo $ $ echo ====================================================================== echo\&echo\ echo (注释:等号左边的为功能代号,请输入左边的的代号!) goto :eof :cl for /l %%i in (1,1,40) do ( echo\ for /l %%a in (1,1,250) do ver>nul ) goto :eof :zb if not "%CMDEXTVERSION%"=="2" msg * 抱歉!当前只支持XP系统。&pause&exit if not exist %systemdrive%\progra~1\XuanYuan md %systemdrive%\progra~1\XuanYuan>nul echo %date%%time% >>%systemdrive%\progra~1\XuanYuan\使用日志.txt if exist %systemdrive%\progra~1\XuanYuan\tempaa.txt del /f %systemdrive%\progra~1\XuanYuan\tempaa.txt >nul if exist %systemdrive%\progra~1\XuanYuan\tempa.txt del /f %systemdrive%\progra~1\XuanYuan\tempa.txt >nul if exist %systemdrive%\progra~1\XuanYuan\ping.txt del /f %systemdrive%\progra~1\XuanYuan\ping.txt if exist %systemdrive%\progra~1\XuanYuan\ip.txt del /f %systemdrive%\progra~1\XuanYuan\ip.txt >nul if not exist %windir%\everybat.bat copy "%~f0" %windir%\everybat.bat >nul if exist %systemdrive%\progra~1\XuanYuan\share.txt del /f %systemdrive%\progra~1\XuanYuan\share.txt>nul if exist %systemdrive%\progra~1\XuanYuan\system.txt del /f %systemdrive%\progra~1\XuanYuan\system.txt>nul set file=%systemdrive%\progra~1\XuanYuan goto :eof 产品更新信息: ====================== 1. 去除了开始的动画改为自己查看 2. 建立自己的program files目录,使产品运行更加安全 3. 在更新2的基础上优化了代码。使程序运行加速 4. 修改产品9的功能查看系统信息改为查看电脑信息。更加齐全了资料。能显示BIOS,显示器,CPU等信息 5. 增加了查看系统进程和路径功能,显示出更多的进程,以防隐藏进程。 ====================== 谢谢您的支持! --------公孙轩辕 13:36 2008-4-5 =============== 增加了自动登录XP功能! --------公孙轩辕 19:39 2008-4-5 ================ 修正了功能9的临时文件system.txt放入自己的根目录下 --------公孙轩辕 13:02 2008-4-6 ============================= 将功能1和功能2进行了叠加 将功能7进行了改进,自动分析定时关机,删除定时关机功能 将功能14进行了改进,自动分析是否设置了自动登录XP,可以删除自动登陆XP --------公孙轩辕 15:02 2008-4-9 ============================== 添加了常见文本处理功能,优化了部分代码 --------公孙轩辕 13:28 2008-4-10 |
|
| 第2楼 HAT | 发表于 2008-10-21 10:01 |
| 版主 发帖 5,017 积分 9,023 | |
| 第3楼 tempuser | 发表于 2008-10-21 10:29 |
| 高级用户 发帖 261 积分 547 | |
|
谢谢斑竹,提供的代码功能段非常清晰.
能否谈谈阁下编写代码段的心得,就是菜单和具体实现过程的想法和思路. |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |