close

今天在 powershell 使用 curl 發現怎麼指令跟 linux 不一樣...

才知道原來有用 alias 連到 windows 的指令

不是 curl 別亂 alias 騙人阿..

解法:

使用系統管理員執行 Powershell 然後執行以下指令

# Check if PowerShell profile exists
test-path $profile
# Create profile if one doesn't exist
new-item $profile
# Edit the profile
notepad $profile
# Add the following like
remove-item alias:curl
# Apply the new profile
. $profile

ref: https://github.com/lukesampson/scoop/issues/56

這樣就可以使用系統內建的 curl

但如果想使用最新版的 curl 可透過 chocolatey 來安裝

安裝 curl

choco install curl

最後記得到系統環境變數把 chocolatey bin 移到 system32 前面才能用到最新的囉

未命名.png

 

ps. 如果遇到 "因為這個系統上已停用指令碼執行,所以無法載入..."

# 查看目前權限
Get-ExecutionPolicy
# 修改權限成遠端腳本才需要發行者簽屬
Set-ExecutionPolicy RemoteSigned

ref: https://hsiangfeng.github.io/other/20200510/1067127387/

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JohnDX 的頭像
    JohnDX

    我要回家想一想~

    JohnDX 發表在 痞客邦 留言(0) 人氣()