Skip to content

Windows 安装脚本在默认 PowerShell 执行策略下闪退且无错误提示 || Windows installation script crashes without error prompt under default PowerShell execution policy #1513

@Must77

Description

@Must77

What version of Kimi Code CLI is running?

未安装成功 - 问题发生在首次安装阶段。当时版本 v1.22.0

Which open platform/subscription were you using?

N/A

Which model were you using?

N/A

What platform is your computer?

Window 10 和 Window 11,无法查询更具体型号

What issue are you seeing?

在干净的 Windows 环境下运行官网推荐的安装命令时,PowerShell 窗口会直接闪退(瞬间关闭),没有任何错误提示或日志输出,用户无法获知失败原因。

根本原因分析:
Windows 默认 PowerShell 执行策略为 Restricted,阻止了 Invoke-Expression 执行远程脚本。而安装脚本中设置了 $ErrorActionPreference = "Stop" 且缺乏错误捕获,导致权限错误直接触发进程终止,窗口关闭。

也就是说,需要在执行安装脚本前执行 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

What steps can reproduce the bug?

0代码环境的 Windows 电脑

打开 PowerShell 粘贴并执行官网命令:irm https://code.kimi.com/install.ps1 | iex

观察现象:PowerShell 窗口瞬间关闭,无任何提示,回到桌面

What is the expected behavior?

用户应该不单独执行 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process ,而直接采用官网提供的单条安装命令即可成功安装。单独 Debug 对于非程序员来说很困难。

Additional information

已经在 Win10 和 Win11 上复现,均为0代码环境。


What version of Kimi Code CLI is running?

Installation not successful - the problem occurred during the first installation phase. The current version was v1.22.0

Which open platform/subscription were you using?

N/A

Which model were you using?

N/A

What platform is your computer?

Window 10 and Window 11, unable to query more specific models

What issue are you seeing?

When running the installation command recommended by the official website in a clean Windows environment, the PowerShell window will crash directly (close instantly) without any error prompt or log output, and the user cannot know the reason for the failure.

Root cause analysis:
The default Windows PowerShell execution policy is Restricted, which prevents Invoke-Expression from executing remote scripts. However, $ErrorActionPreference = "Stop" is set in the installation script and there is a lack of error capture, causing permission errors to directly trigger process termination and window closing.

In other words, Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process needs to be executed before executing the installation script.

What steps can reproduce the bug?

0 code environment Windows computer

Open PowerShell, paste and execute the official website command: irm https://code.kimi.com/install.ps1 | iex

Observation phenomenon: The PowerShell window closes instantly without any prompt and returns to the desktop.

What is the expected behavior?

Users should not execute Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process separately, but directly use the single installation command provided by the official website to successfully install. Debugging alone is difficult for non-programmers.

Additional information

It has been reproduced on Win10 and Win11, both in 0 code environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions