小编xer*_*985的帖子

Powershell Invoke-Web请求下载并保存所有文件?

在尝试利用 PowerShell 自动化提取文件、对文件执行某些操作,然后将它们复制到其他地方的过程中,我已经完成了大部分过程。我遇到的唯一问题是我无法调用网络请求来下载多个文件。

# Specify variables

$SVN_BASE = "website ommitted" 
$SCCM_PATH = "path omitted"
$LOKI_PATH = "path omitted"
$INSTALLER_NAME = "Firefox Setup 58.0.1.exe"
$PROJECT_FOLDER = "mozilla_firefox_rr"

# Set an alias for the executable 7zip to be called to extract files

set-alias 7z "$env:ProgramFiles\7-Zip\7z.exe"

# Create the working directory for the application

new-item -path "$($env:userprofile)\Desktop" -name $PROJECT_FOLDER -itemtype 
directory -Force

# Change the directory to the working directory 

set-location "$($env:userprofile)\Desktop\$PROJECT_FOLDER"

# Invoke-WebRequest is aka wget. Here, we are downloading …
Run Code Online (Sandbox Code Playgroud)

powershell

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

powershell ×1