2

目前我有这段简短的代码。该 URLhttps://dosomething.do会生成一个 .csv 文件。我可以运行 powershell 代码,在 shell 中我可以看到文件的内容。但是文件本身没有下载。我想指定下载后的保存位置。我在这里有什么选择?

$securepassword = ConvertTo-SecureString "xxx" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential("hxxx", $securepassword)
Invoke-WebRequest -Uri "https://dosomething.do" -Credential $credentials
4

1 回答 1

3

使用 的-OutFile参数Invoke-WebRequest

Invoke-WebRequest -Uri "https://dosomething.do" -OutFile C:\some\path\to\yourfile.csv
于 2018-02-21T10:19:28.410 回答