Board logo

标题: [其他] 求批处理:将网页内容保存为555.txt,谢谢 [打印本页]

作者: yyz219    时间: 2022-11-30 10:24     标题: 求批处理:将网页内容保存为555.txt,谢谢

求批处理:将网页内容保存为555.txt
例如:https://site.ip138.com/103.219.30.193里面内容保存为555.txt
作者: 5872169    时间: 5 天前 17:15

回复 1# yyz219
用curl命令
作者: newswan    时间: 5 天前 22:32

powershell 试试
  1. $url = "https://site.ip138.com/103.219.30.193"
  2. $web = Invoke-RestMethod $url
  3. $web
复制代码

作者: yyz219    时间: 4 天前 08:26

回复 2# 5872169


    谢谢
作者: yyz219    时间: 4 天前 08:27

回复 3# newswan


    谢谢
作者: aloha20200628    时间: 4 天前 11:14

本帖最后由 aloha20200628 于 2024-6-29 11:27 编辑


批处无须下载第三方而利用系统内置资源直接在命令行调用下载网页的方法,至少有以下三种...

一。bitsadmin.exe,虽已被微软官宣会被powershell有关功能接管,但win8.1简中系统验证依然有效
命令行用法示例》其中下载结果文件名须为全路径,详细用法参数可用 bitsadmin /? 查看
  1. bitsadmin /transfer "自定义任务名" /dynamic /download /priority normal "http://www.bathome.net/index.php" "c:\temp\下载网页.txt"
复制代码
二。certutil.exe,详细用法参数可用 certutil /? 查看
  1. certutil -urlcache -split -f "http://www.bathome.net/index.php" "下载网页.txt"
复制代码
三。powershell,两个下载网络数据的方法
第一方法
  1. powershell -c "(new-object System.Net.WebClient).DownloadFile('http://www.bathome.net/index.php', '下载网页.txt')"
复制代码
第二方法
  1. powershell -c "invoke-webrequest -uri 'http://www.bathome.net/index.php' -outfile '下载网页.txt'"
复制代码

作者: yyz219    时间: 3 天前 08:53

回复 6# aloha20200628


    谢谢




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2