Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
设置变量 helpText -option 常量 -value "somevalue"
Set-Variable :无法覆盖变量 helpText,因为它是只读的或常量。
我在电源外壳中收到以下错误。有人可以让我知道我在这里缺少什么。
提前致谢
常量变量不能被删除,它的属性不能被改变。
要删除它,您只能关闭当前会话并重新开始。
请考虑改用 ReadOnly 选项。然后你可以用-Forceswitch覆盖它。
-Force
正如对问题的评论中已经说过的那样,constant变量在运行时不能更改。
constant
如下声明变量,而不是你可以覆盖它-Force
Set-Variable helpText "somevalue" -Option ReadOnly