首页 > 解决方案 > 如何使用 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

我是 PowerShell 的新手,因此我们将不胜感激任何帮助。

标签: powershellgithub

解决方案


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

https://github.com/soulcurrymedia/twitter-emotion-recognition/raw/master/models/allowed-chars.pkl

推荐阅读