命令属性

常见别名:wget curl

Get-Help Invoke-WebRequest

名称
    Invoke-WebRequest

语法
    Invoke-WebRequest [-Uri] <uri>  [<CommonParameters>]


别名
    iwr
    wget
    curl

获取内容

Invoke-WebRequest -Uri "https://baidu.com"                                                                                               

StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE html><!--STATUS OK--><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><meta http-equiv="X-UA-Compatib
                    le" content="IE=edge,chrome=1"><meta content="always" name="...
RawContent        : HTTP/1.1 200 OK
                    Bdpagetype: 1
                    Bdqid: 0xf0bdbbf80006b41f
                    Connection: keep-alive
                    Content-Type: text/html; charset=utf-8
                    Date: Mon, 25 Jul 2022 09:25:55 GMT
                    P3P: CP=" OTI DSP COR IVA OUR IND COM ",...
Forms             : {form}
Headers           : {[Bdpagetype, 1], [Bdqid, 0xf0bdbbf80006b41f], [Connection, keep-alive], [Content-Type, text/html; charset=utf-8]...}
Images            : {@{innerHTML=; innerText=; outerHTML=<img src="https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newfanyi-da0cea8f7e.png
                    ">; outerText=; tagName=IMG; src=https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newfanyi-da0cea8f7e.png}, @{innerHTML
                    =; innerText=; outerHTML=<img src="https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newxueshuicon-a5314d5c83.png">; out
                    erText=; tagName=IMG; src=https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newxueshuicon-a5314d5c83.png}, @{innerHTML=;
                     innerText=; outerHTML=<img src="https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newwenku-d8c9b7b0fb.png">; outerText=
                    ; tagName=IMG; src=https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newwenku-d8c9b7b0fb.png}, @{innerHTML=; innerText=;
                     outerHTML=<img src="https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newbaike-889054f349.png">; outerText=; tagName=IM
                    G; src=https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/newbaike-889054f349.png}...}
InputFields       : {@{innerHTML=; innerText=; outerHTML=<input name="ie" type="hidden" value="utf-8">; outerText=; tagName=INPUT; name=ie; type=hidden; value=u
                    tf-8}, @{innerHTML=; innerText=; outerHTML=<input name="f" type="hidden" value="8">; outerText=; tagName=INPUT; name=f; type=hidden; value=8
                    }, @{innerHTML=; innerText=; outerHTML=<input name="rsv_bp" type="hidden" value="1">; outerText=; tagName=INPUT; name=rsv_bp; type=hidden; v
                    alue=1}, @{innerHTML=; innerText=; outerHTML=<input name="rsv_idx" type="hidden" value="1">; outerText=; tagName=INPUT; name=rsv_idx; type=h
                    idden; value=1}...}
Links             : {@{innerHTML=; innerText=; outerHTML=<a tabindex="0" id="aging-total-page" role="pagedescription" aria-label="欢迎进入 百度一下,你就知道,
                    盲人用户进入读屏幕模式请按快捷键 Ctrl 加 Alt 加 R;阅读详细操作说明请按快捷键 Ctrl 加 Alt 加问号键。" href="javascript:void(0)"></a>; outerText=; tag
                    Name=A; tabindex=0; id=aging-total-page; role=pagedescription; aria-label=欢迎进入 百度一下,你就知道,盲人用户进入读屏幕模式请按快捷键 Ctrl
                    加 Alt 加 R;阅读详细操作说明请按快捷键 Ctrl 加 Alt 加问号键。; href=javascript:void(0)}, @{innerHTML=百度首页; innerText=百度首页; outerHTML=<a cl
                    ass="toindex" href="/"> 百度首页</a>; outerText=百度首页; tagName=A; class=toindex; href=/}, @{innerHTML=设置<i class="c-icon c-icon-triangle
                    -down"></i>; innerText=设置; outerHTML=<a name="tj_settingicon" class="pf" href="javascript:;"> 设置<i class="c-icon c-icon-triangle-down"></
                    i></a>; outerText=设置; tagName=A; name=tj_settingicon; class=pf; href=javascript:;}, @{innerHTML=登录; innerText=登录; outerHTML=<a name="t
                    j_login" class="lb" onclick="return false;" href="https://passport.baidu.com/v2/?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2F&amp;sm
                    s=5"> 登录</a>; outerText=登录; tagName=A; name=tj_login; class=lb; onclick=return false;; href=https://passport.baidu.com/v2/?login&amp;tpl=
                    mn&amp;u=http%3A%2F%2Fwww.baidu.com%2F&amp;sms=5}...}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 360368

导出保存

Invoke-WebRequest -Uri "https://baidu.com" -OutFile ".\webpage.html"

0 条评论

发表评论

Avatar placeholder

您的电子邮箱地址不会被公开。