Windows
1 前言
一个问题,一篇文章,一出故事。
笔者最近新装了一台Windows 2019的系统(没有桌面),需要通过命令行下载文件,于是整理此文。
2 最佳实践
2.1 命令使用帮助
Get-Help wget
可见如下显示,
NAME Invoke-WebRequest SYNTAX Invoke-WebRequest [-Uri] <uri> [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>] [-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>] [-Certificate <X509Certificate>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>] [-MaximumRedirection <int>] [-Method {Default | Get | Head | Post | Put | Delete | Trace | Options | Merge | Patch}] [-Proxy <uri>] [-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <string>] [-TransferEncoding {chunked | compress | deflate | gzip | identity}] [-InFile <string>] [-OutFile <string>] [-PassThru] [<CommonParameters>] ALIASES iwr wget curl REMARKS Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help. -- To download and install Help files for the module that includes this cmdlet, use Update-Help. -- To view the Help topic for this cmdlet online, type: "Get-Help Invoke-WebRequest -Online" or go to https://go.microsoft.com/fwlink/?LinkID=217035.
注:从以上可知“iwr”、“wget”和“curl”只是“Invoke-WebRequest”命令的别名
2.2 使用范例
wget -Uri https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe -OutFile WeChatSetup.exe
没有评论