我正在尝试使用 PowerShell 下载 PuTTY 可执行文件,但无法获取临时路径上的文件。
我的脚本:
$Url = "https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe"
$Path = "C:%homepath%\AppData\Local\Temp\putty.exe"
$Wc = New-Object System.Net.WebClient
$Wc.DownloadFileAsync($Url,$Path)
我正在通过 CMD 执行以下命令:
powershell.exe "-ExecutionPolicy" "RemoteSigned" "-file" "test.ps1"