本帖最后由 yyz219 于 2022-12-3 09:41 编辑
完美解决了问题:
粘贴剪切板内容--回车.vbs:- Wsh.Sleep 100 '【延时100毫秒】
- '【在bat窗口粘贴剪切板内容】
- Dim oWshShell, s
- Set oWshShell = CreateObject("WScript.Shell")
- s = CreateObject("htmlfile").parentWindow.clipboardData.getData("text")
- oWshShell.SendKeys s
-
- '【按"回车"键】
- createobject("wscript.shell").sendkeys "{ENTER}" '【按"ENTER"】
复制代码 ****************************************************
复制ip双击抓取域名(好).bat- ::【最终文件在桌面:数字ip地址.txt】
- @echo off
- ::【粘贴数字ip地址 →→→ 抓取域名(保存为:00.txt)】
- start "" "粘贴剪切板内容--回车.vbs"
- set /p M=粘贴数字ip地址:(由 “粘贴剪切板内容--回车.vbs” 完成)
- echo.
- echo.
- echo 请耐心等待... ...
- set "url=https://site.ip138.com/%M%"
- ::set "url=https://site.ip138.com/183.131.207.66/"
- PowerShell -NoProfile -C "$str=(New-Object System.Net.WebClient).DownLoadString('%url%'); [regex]::Matches($str, '</span><a href=\"/([^^/]+)/\"') | forEach{ $_.Groups[1].Value }" >00.txt
- ::*************************************************************
- ::【(行首加0.0.0.0 )( 行尾加 #【】)(保存为:01.txt) 】
- set "strOne=0.0.0.0 " %【行首添加字符】%
- set "strTwo= #【】" %【行尾添加字符】%
- for /f "tokens=*" %%i in (00.txt) do (>>"01.txt" echo %strOne%%%i%strTwo%)
- ::++++++++++++++++++++++++++++++++++++++++++++++
- ::【开头加一行:ip地址 (其中:%M% ————数字ip地址)(保存为:D:\桌面\数字ip地址.txt)】
- (
- echo # 【ip地址】:%M% 【文件在桌面】
- type "01.txt"
- )>"D:\桌面\Desktop\%M%.txt"
- ::++++++++++++++++++++++++++++++++++++++++
- del 00.txt "01.txt"
- start "" "D:\桌面\Desktop\%M%.txt"
- exit
复制代码
|