标题: [其他] 请教检测系统sp版本的批处理如何优化? [打印本页]
作者: quake_wu 时间: 2009-11-20 14:04 标题: 请教检测系统sp版本的批处理如何优化?
写了一个扫描局域网哪些电脑是sp1,哪些电脑是sp2的检测脚本
请帮忙看看有哪些纰漏或者需要改进的地方- @echo off
- del %temp%\GetHostname.txt 2>nul
- Echo Now is Scanning 192.168.0.0/24
- for /l %%i in (1,1,254) do ping -a -n 1 192.168.0.%%i&&ping -a -n 1 192.168.0.%%i|find "Pinging" >>%temp%\GetHostname.txt
- Echo Now is Scanning 192.168.1..0/24
- for /l %%i in (1,1,254) do ping -a -n 1 192.168.1.%%i&&ping -a -n 1 192.168.1.%%i|find "Pinging" >>%temp%\GetHostname.txt
- Echo Now is Scanning 192.168.2.0/24
- for /l %%i in (1,1,254) do ping -a -n 1 192.168.2.%%i&&ping -a -n 1 192.168.2.%%i|find "Pinging" >>%temp%\GetHostname.txt
-
- Echo.>>c:\ok.txt&Echo Scan time begin from %date%/%time% >>c:\ok.txt
- Echo.>>c:\ok.txt&Echo These Servers are Service pack 1 >>c:\ok.txt
- for /f "tokens=2 delims= " %%i in (%temp%\GetHostname.txt) do reg query "\\%%i\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /v csdversion |find "Service Pack 1" && Echo %%i >>c:\ok.txt
- Echo ------------------------------------------------>>c:\ok.txt
-
- Echo These Servers are Service pack 2 >>c:\ok.txt
- Echo.>>c:\ok.txt
- for /f "tokens=2 delims= " %%i in (%temp%\GetHostname.txt) do reg query "\\%%i\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /v csdversion |find "Service Pack 2" && Echo %%i >>c:\ok.txt
-
- Echo.>>c:\ok.txt&Echo Scan time End from %date%/%time% >>c:\ok.txt
- Echo The result Will be saved at c:\ok.txt
- Echo Press any key to Exit
- pause>nul
复制代码
[ 本帖最后由 quake_wu 于 2009-11-20 15:19 编辑 ]
作者: Batcher 时间: 2009-11-20 19:03
参考:http://bbs.bathome.net/viewthread.php?tid=4482#pid28940
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |