2013-07-05 73 views
1

我要拆分的文本"Account D:\Bank\Account"white space文本,所以零件會AccountD:\Bank\Account,但出現一些錯誤信息,有什麼問題呢?不能分割以空格

這裏是我的代碼

$Path_info = "Account D:\Bank\Account" 
$Account = $Path_info.Split(" ") 
write-host $Acoount[0] 

錯誤信息

enter image description here

+1

嘗試沒有錯字'write-host $ Account [0]';) –

+2

使用[嚴格模式](http://technet.microsoft.com/en-us/library/ff730970.aspx)來檢測錯字在變量名稱,不存在的屬性和whatnot。 – vonPryz

回答

1

你有

write-host $Acoount[0] 

一個錯字應

write-host $Account[0] 

除此之外,你的代碼工作正常。