Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 我的$PROFILE环境变量有问题吗?_Powershell_Windows 10_Profile - Fatal编程技术网

Powershell 我的$PROFILE环境变量有问题吗?

Powershell 我的$PROFILE环境变量有问题吗?,powershell,windows-10,profile,Powershell,Windows 10,Profile,如果我执行 & $PROFILE 我得到这个错误 & : The term 'C:\Users\stib\Documents\WindowsPowerShell\ Microsoft.PowerShell_profile.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 pa

如果我执行

& $PROFILE
我得到这个错误

& : The term 'C:\Users\stib\Documents\WindowsPowerShell\ Microsoft.PowerShell_profile.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 that the path is correct and try again. At line:1 char:3 + & $PROFILE + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Users\stib...ell_profile.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
正确的配置文件位于$profile.CurrentUserAllHosts。我的设置有问题吗?

此行为的原因是$Profile.ToString的默认选择,当您使用$Profile.CurrentUserCurrentHost的&operator调用它时,会调用该字符串

有选择地执行您的配置文件,而不是依赖默认设置:

& $Profile.CurrentUserAllHosts
作为脚注,$Profile只是一个扩展的System.String,它添加了属性和修改的ToString方法。见:

$Profile | Get-Member -MemberType NoteProperty

此外,当您启动当前shell时,应用于当前shell的配置文件将自动执行,除非将-NoProfile传递给可执行文件。

此行为的原因是$Profile.ToString的默认选择,当您使用&operator调用$Profile.CurrentUserCurrentHost时,会调用该选项

有选择地执行您的配置文件,而不是依赖默认设置:

& $Profile.CurrentUserAllHosts
作为脚注,$Profile只是一个扩展的System.String,它添加了属性和修改的ToString方法。见:

$Profile | Get-Member -MemberType NoteProperty

此外,当您启动当前shell时,将自动执行应用于该shell的配置文件,除非将-NoProfile传递给可执行文件。

转到C:\Users\stib\Documents\WindowsPowerShell我相信您会发现您没有Microsoft.PowerShell\u profile.ps1 Drew所说的。运行&$PROFILE.CurrentUserAllHosts,如果这是您真正想要执行的。不过,这应该不是必需的,b/c PowerShell应该在启动时自动加载相关的。是的,当我启动PS会话时,我的配置文件已正确加载,我只是想知道我是否误解了某些我惯常做的事情。转到C:\Users\stib\Documents\WindowsPowerShell我相信你会发现你没有Microsoft.PowerShell\u profile.ps1 Drew说的话。运行&$PROFILE.CurrentUserAllHosts,如果这是您真正想要执行的。不过,这应该不是必需的,b/c PowerShell应该在启动时自动加载相关的。是的,当我启动PS会话时,我的配置文件加载正确,我只是想知道我是否像往常一样配置错误。