iwr 是 PowerShell 中的 Invoke-WebRequest 命令的别名,用于在 Windows 系统中通过 PowerShell 发起 HTTP/HTTPS 请求并获取内容。你提供的命令 iwr -useb https://openclaw.ai/install.ps1 | iex 是一个典型的 PowerShell 一键安装脚本执行方式,其含义是:使用 Invoke-WebRequest 以无缓冲模式(-useb)下载指定 URL 的 PowerShell 脚本,然后通过管道传递给 iex(即 Invoke-Expression)直接执行该脚本。
如何安装或启用 iwr(Invoke-WebRequest)
iwr 本身是 PowerShell 内置命令,无需单独安装,但需要确保系统满足以下条件:
-
系统要求
- Windows 系统 :Windows 7 及以上版本通常已内置 PowerShell(≥ 2.0),
iwr在 PowerShell 3.0 及以上版本中默认可用。 - 非 Windows 系统 (如 Linux/macOS):
-
若要在 Linux/macOS 中使用类似功能,需安装 PowerShell Core(即跨平台版本的 PowerShell)。
-
安装命令示例(以 Ubuntu 为例):
# 安装 PowerShell Core sudo apt update && sudo apt install -y powershell -
安装后通过
pwsh命令启动 PowerShell,即可使用iwr。
-
- Windows 系统 :Windows 7 及以上版本通常已内置 PowerShell(≥ 2.0),
-
验证是否可用
打开 PowerShell(Windows 用户按
Win + R输入powershell;Linux/macOS 用户运行pwsh),执行以下命令检查:Get-Command Invoke-WebRequest若返回命令信息,则说明已可用;若提示"找不到命令",可能需要升级 PowerShell 版本。
-
**升级 PowerShell(如需)**
- Windows :可通过 Microsoft 官方文档 下载最新版本安装。
- Linux/macOS :参考 PowerShell GitHub 仓库 的安装指南。
-
执行你提供的命令的注意事项
-
安全性警告 :
iex会直接执行远程脚本,请确保https://openclaw.ai/install.ps1来源可信。 -
权限问题 :若遇到执行策略限制,可以临时允许脚本运行(仅限可信场景):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
-
备用方案:使用其他工具替代 iwr
如果无法使用 PowerShell,可通过以下工具实现类似功能:
-
curl (Linux/macOS/Windows 均可安装):
curl -sSL https://openclaw.ai/install.ps1 | powershell -Command - -
wget (Linux/macOS 常见):
wget -qO- https://openclaw.ai/install.ps1 | powershell -Command -
总结
iwr是 PowerShell 内置命令,无需单独安装,只需确保系统已安装 PowerShell(≥ 3.0)。- 非 Windows 系统需安装 PowerShell Core 才能使用。
- 执行远程脚本前务必确认来源可信,注意安全风险。