【问题标题】:Edit PowerShell script while it's running在运行时编辑 PowerShell 脚本
【发布时间】:2020-06-26 18:44:56
【问题描述】:

显然,在执行 Linux shell 脚本时对其进行编辑会导致 undefined behavior

在执行 PowerShell 脚本时编辑它会发生什么?

【问题讨论】:

  • 什么也没发生。 PowerShell 在执行之前读取并解析整个脚本
  • @MathiasR.Jessen 是所有受支持平台下所有 PowerShell 版本的行为吗?
  • 至少从 3.0 开始,我不记得(也无法访问)2.0 版

标签: windows powershell shell


【解决方案1】:

PowerShell 会从上到下解析所有内容,并且不会再返回。
一旦它进入,它就在:)
例如,如果您需要重新加载 PowerShell 模块到当前会话中,您必须使用 -Force 标志。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-23
    • 2021-05-13
    相关资源
    最近更新 更多