Board logo

标题: 帮忙看看这段批处理 [打印本页]

作者: bbq123bbq     时间: 2007-7-26 20:05    标题: 帮忙看看这段批处理
@echo off if exist test.txt del /q test.txt for /l %%i in (170,1,200) do echo 192.168.0.%%i>>test.txt for /f "tokens=14 delims=: " %%i in ('ipconfig^|find /i "ip address"') do set ip=%%i findstr /c:"%ip%" test.txt if %errorlevel%==0 goto vip if %errorlevel%==1 goto start exit :start echo 正在更换桌面 ...... ping -n 2 127.1>nul reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /d \\192.168.0.246\system$\创世纪.bmp /f RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters exit :vip echo 正在更换桌面 ...... ping -n 2 127.1>nul reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /d \\192.168.0.246\system$\创世纪vip.bmp /f RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters exit 帮忙看看这段批处理有什么问题,为是什么IP是192.168.0.1 和 192.168.0.17 192.168.0.18 192.168.0.19 192.168.0.20 都算成是(170,1,200)范围的机...都是调用 :vip ??还有 @echo off for /f "tokens=14 delims=: " %%i in ('ipconfig^|find /i "IP Address"') do if "%%i" geq "192.168.0.170" if "%%i" leq "192.168.0.186" (set wallpaper=创世纪vip.bmp) else set wallpaper=创世纪.bmp :start echo 正在更换桌面 ...... ping -n 2 127.1>nul reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /d "\\192.168.0.246\system$\%wallpaper%" /f RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters 也是出现同样的问题..IP是192.168.0.1 和 192.168.0.17 192.168.0.18 192.168.0.19 192.168.0.20 也是用 创世纪vip.bmp 做桌面而不是用 创世纪.bmp 这批处理那里出问题??

作者: slore     时间: 2007-7-26 20:17
192.168.0.1 匹配192.168.0.170~199 192.168.0.17匹配192.168.0.170~179 192.168.0.18匹配192.168.0.180~189 192.168.0.19 匹配192.168.0.190~199 192.168.0.20匹配192.168.0.200 原因相同……

作者: wudixin96     时间: 2007-7-26 20:29
findstr /c:"%ip%" test.txt 问题就在这里

作者: bbq123bbq     时间: 2007-7-27 01:29
可以说明一下问题和如何解决??3楼知道问题所在能不能给个解决方案??

作者: wudixin96     时间: 2007-7-27 07:43
findstr /c:"\<%ip%\>" test.txt 这样似乎是可以的,没测试

作者: slore     时间: 2007-7-27 09:36
192.168.0.170这个IP 包含子字符串"192.168.0.1" 和“192.168.0.17”明白? 你可以在你的IP后面加个结束的符号 @echo off if exist test.txt del /q test.txt for /l %%i in (170,1,200) do echo 192.168.0.%%i.>>test.txt set ip=192.168.0.172. findstr /c:"%ip%" test.txt if %errorlevel%==0 goto vip if %errorlevel%==1 goto start :Vip echo vip goto End :start echo start goto End :End pause