2012-11-01 32 views
0

我在这里用我的用户配置文件路径与powershell配合使用时遇到了一些问题。 我有我的profile.ps1设置为此:用户配置文件搞砸

$Shell = Host.UI.RawUI 
$Shell.WindowTitle="PowerShell obeys me!" 
$Shell.BackgroundColor="White" 
$Shell.ForegroundColor="Blue" 
$size = $Shell.WindowSize 
$size.width=120 
$size.height=50 
$Shell.WindowSize = $size 
$size = $Shell.BufferSize 
$size.width=120 
$size.height=5000 
$Shell.BufferSize = $size 

,但每次我执行运行poweshell,它显示了一些erors像这样的:

Property 'WindowTitle' cannot be found on this object; make sure it exists and is settable. 
At D:\data\d7bighs\Documents\WindowsPowerShell\profile.ps1:5 char:8 
+ $Shell. <<<< WindowTitle="PowerShell obeys me!" 
    + CategoryInfo   : InvalidOperation: (WindowTitle:String) [], RuntimeException 
    + FullyQualifiedErrorId : PropertyNotFound  

现在我检查我的个人资料就告诉我这:

$profile 
d:\data\myusername\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 

,但如果我通过窗户查看该资源管理器,它告诉我:

d:\User\myusername\Documents\WindowsPowerShell\profile.ps1 

林困惑在这里,因为资源管理器中告诉我,D:\ Useres但PS显示它为d:\数据...

我怎样才能改变这种或强制PS d照顾:\用户而不是d :\数据?

回答

0

一个微小的错误:$Shell = $Host.UI.RawUI,你可能需要通过

New-Item -Path $PROFILE -Type file 

首先创建配置文件,然后通过

notepad $PROFILE 
+0

嗨非常感谢编辑......这个小小的错误,我没有见=) – user1790927