簡體   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