找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 21639|回复: 1

[文本处理] 批处理获取外网IP 写入到指定位置,请大家看看可有好办法,先谢过!

[复制链接]
发表于 2014-12-11 16:36:03 | 显示全部楼层 |阅读模式
下面这段代码是手动收入 ip地址  替换掉  conf.ini 中的 22.223.90.78    能否自动的 让外网地址写入到  22.223.90.78  位置
  1. @echo off
  2. color 4f
  3. setlocal enabledelayedexpansion
  4. set file=Conf.ini
  5. set "file=%file:"=%"
  6. for %%i in ("%file%") do set file=%%~fi
  7. echo.
  8. set replaced=22.223.90.78
  9. echo.
  10. set all=
  11. set /p all=  请输入你的服务器IP地址:
  12. for /f "delims=" %%i in ('type "%file%"') do (
  13.     set str=%%i
  14.     set "str=!str:%replaced%=%all%!"
  15.     echo !str!>>"%file%"_tmp.txt
  16. )
  17. move "%file%"_tmp.txt "%file%"
复制代码
发表于 2014-12-11 17:16:36 | 显示全部楼层
批处理怎样获取外网IP地址?
http://bbs.bathome.net/thread-2870-1-1.html

批处理如何正确获得外网、内网IP并纪录?
http://bbs.bathome.net/thread-4978-1-1.html

VBS获取外网IP
http://bbs.bathome.net/thread-546-1-1.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-20 04:51 , Processed in 0.015204 second(s), 7 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表