如何在 powershell 中下载整个 dropbox 目录?
How to download an entire dropbox directory in powershell?
我试过一个简单的:
wget https://www.dropbox.com/sh/dropboxStuff/dropboxStuff?dl=1 -O DirectoryName
但它正在下载一个 zip 文件。
- 只用powershell下载解压最好的方法是什么
命令?
- 可以一行完成吗?
在 Powershell v5 中
Expand-Archive c:\a.zip -DestinationPath c:\a
了解您的PS版本
$PSVersionTable.PSVersion
如果您没有 PS v5
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
Unzip "C:\a.zip" "C:\a"
来源:
要使用 PowerShell 5 的 Expand-Archive
cmdlet 在一行中完成此操作:
Invoke-WebRequest -Uri https://www.dropbox.com/sh/dropboxStuff/dropboxStuff?dl=1 -O temp.zip; Get-Item temp.zip | Expand-Archive -DestinationPath "FolderName"; Remove-Item temp.zip
你 可能 可以通过管道 Invoke-WebRequest
到 Expand-Archive
和 -PassThru
来做到这一点,但我没能做到它仍然有效。
我试过一个简单的:
wget https://www.dropbox.com/sh/dropboxStuff/dropboxStuff?dl=1 -O DirectoryName
但它正在下载一个 zip 文件。
- 只用powershell下载解压最好的方法是什么 命令?
- 可以一行完成吗?
在 Powershell v5 中
Expand-Archive c:\a.zip -DestinationPath c:\a
了解您的PS版本
$PSVersionTable.PSVersion
如果您没有 PS v5
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
Unzip "C:\a.zip" "C:\a"
来源:
要使用 PowerShell 5 的 Expand-Archive
cmdlet 在一行中完成此操作:
Invoke-WebRequest -Uri https://www.dropbox.com/sh/dropboxStuff/dropboxStuff?dl=1 -O temp.zip; Get-Item temp.zip | Expand-Archive -DestinationPath "FolderName"; Remove-Item temp.zip
你 可能 可以通过管道 Invoke-WebRequest
到 Expand-Archive
和 -PassThru
来做到这一点,但我没能做到它仍然有效。