如何使用 PowerShell 从 github 下载文件到本地目录

Sta*_*kos 2 powershell github

我正在寻找一种使用 PowerShell 命令从 github 下载特定文件的方法。

我尝试下载的文件的 URL 如下:https://github.com/soulcurrymedia/twitter-emotion-recognition/blob/master/models/allowed-chars.pkl

我已尝试以下操作,但它下载了 html 脚本而不是实际文件

$url = "https://github.com/soulcurrymedia/twitter-emotion-recognition/blob/master/models/allowed-chars.pkl"

$output = "C:\code\queues\models\allowed-chars.pkl"

Invoke-WebRequest -Uri $url -OutFile $output

Run Code Online (Sandbox Code Playgroud)

我是 PowerShell 新手,因此我们将不胜感激。

小智 5

您需要使用直接下载链接才能正常工作。在这种情况下,链接是:

https://github.com/soulcurrymedia/twitter-emotion-recognition/raw/master/models/allowed-chars.pkl
Run Code Online (Sandbox Code Playgroud)