繁体   English   中英

使用以下命令从HTTPS网站下载文件的Powershell脚本

[英]Powershell Script to download a file from HTTPS website using

我需要每天从网站上下载文件,该日期将过去。 我尝试使用以下代码-

$url = "https://www.theocc.com/webapps/threshold-securities?reportDate=20190730"
$output = "C:\Users\Himanshu.Vats\Downloads\"
Invoke-WebRequest -Uri $url -OutFile $output

但这给了错误-

Invoke-WebRequest:基础连接已关闭:发送时发生意外错误。 在第3行:1字符+调用WebRequest -Uri $ url -OutFile $ output + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ +

这是因为您的路径不是路径文件(路径末尾有“ \\”)

尝试这个:

$url = "https://www.theocc.com/webapps/threshold-securities?reportDate=20190730"
$output = "C:\Users\Himanshu.Vats\Downloads\result.csv"
Invoke-WebRequest -Uri $url -OutFile $output

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM