中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-05 10:23
48,038 主题排行 / 350,123 发帖 / 今日 1 篇 / 48,251 会员排行
DOS批处理 & 脚本技术(批处理室) » 帮忙看看这段批处理
可打印版本  804 / 5
第1楼 bbq123bbq 发表于 2007-07-26 20:05
初级用户 发帖 77 积分 197
帮忙看看这段批处理
@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

这批处理那里出问题??
第2楼 slore 发表于 2007-07-26 20:17
铂金会员 发帖 2,478 积分 5,212
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

原因相同……
第3楼 wudixin96 发表于 2007-07-26 20:29
银牌会员 发帖 931 积分 1,928
findstr /c:"%ip%" test.txt

问题就在这里
第4楼 bbq123bbq 发表于 2007-07-27 01:29
初级用户 发帖 77 积分 197
可以说明一下问题和如何解决??3楼知道问题所在能不能给个解决方案??
第5楼 wudixin96 发表于 2007-07-27 07:43
银牌会员 发帖 931 积分 1,928
findstr /c:"\<%ip%\>" test.txt

这样似乎是可以的,没测试
第6楼 slore 发表于 2007-07-27 09:36
铂金会员 发帖 2,478 积分 5,212
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
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023