我有一個「古怪」的PowerShell問題,我希望有人能幫我解決。它可能不是真的是一個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 vs Ascii問題? – 2015-03-13 14:52:08