【发布时间】:2015-03-13 22:52:11
【问题描述】:
我遇到了一个“古怪”的 PowerShell 问题,希望有人能帮我解决。这可能不是真正的 PowerShell 问题,但我已经两次使用 PowerShell。
今天,我下载了 PSUnit。我遵循了安装说明,其中包括将 profile.ps1 复制到我的 PowerShell 配置文件目录中。文件的第一行是:
$PSUnitPath = "D:\Data\PSUnit"
完成安装后,当我在 PowerShell ISE 中打开我的 PSUnit 测试时,我收到以下错误:
The term ' $ P S U n i t P a t h ' 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 that the path is correct an
d try again.
At C:\Users\sfhostingadmin.SCRUMDOMAIN\Documents\WindowsPowerShell\profile.ps1:3 char:24
+ $ P S U n i t P a t h <<<< = " D : \ D a t a \ P S U n i t " # M o d i f y t h i s p a t h t o m a t c h y o u r l o c a l P o w e r S h e l l i n s t a l l a t i o n p a t h
+ CategoryInfo : ObjectNotFound: ( $ P S U n i t P a t h :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
注意,它在所有字母之间插入了一个空格。当我在文本编辑器中打开文件时,多余的空格不存在。
我在简单地打开 Powershell 命令窗口时也收到此错误,即不涉及 ISE。
我认为这不是 PSUnit 问题。我以前在另一个不涉及 PSUnit 的 PowerShell 程序上遇到过这种情况。我当时解决它的唯一方法是打开一个新文件,然后重新键入 PowerShell 程序。
【问题讨论】:
-
您是否检查过这是否是 Unicode 与 Ascii 的问题?
标签: powershell