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 内置命令,无需单独安装,但需要确保系统满足以下条件:

  1. 系统要求

    • 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
  2. 验证是否可用
    打开 PowerShell(Windows 用户按 Win + R 输入 powershell;Linux/macOS 用户运行 pwsh),执行以下命令检查:

    Get-Command Invoke-WebRequest 

    若返回命令信息,则说明已可用;若提示“找不到命令”,可能需要升级 PowerShell 版本。

  3. 升级 PowerShell(如需)

  4. 执行你提供的命令的注意事项

    • 安全性警告‌: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‌ 才能使用。
  • 执行远程脚本前务必确认来源可信,注意安全风险。
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐