0

我无法通过此错误消息。

谢谢

The term 'power-date.ps1' is not recognized as the name of a cmdlet, function, script file
, or operable program. Check the spelling of the name, or if a path was included, verify t
hat the path is correct and try again.
At line:1 char:15
+ power-date.ps1 <<<< 
    + CategoryInfo          : ObjectNotFound: (power-date.ps1:String) [], CommandNotFound 
   Exception
    + FullyQualifiedErrorId : CommandNotFoundException
4

1 回答 1

5

PowerShell 不会在当前目录中运行脚本,除非您为它们添加前缀,.\例如:

.\power-date.ps1

这是一项安全功能,可防止某人将名为 dir 或 ls 的脚本放入黑客可以访问且用户经常在其中的目录中。黑客的意图是当用户执行时dir,假冒的 dir.ps1 将被未知地调用给用户。此安全功能可防止此类攻击。如果用户想要调用脚本 dir.ps1,他们必须通过路径显式引用它,例如.\dir.ps1

于 2013-05-15T16:39:08.163 回答