Windows 7 上 powershell 配置文件的位置

Kdg*_*Dev 7 windows-7 powershell

执行命令时notepad $profile,记事本实例打开,但我收到一条警告,指出路径不存在。

所以我必须手动设置它,有人知道怎么做吗?有几个位置,但我更愿意将配置文件放在正确的位置。

小智 10

可以根据您希望配置文件应用到哪些主机和多少用户来创建多个配置文件脚本。PowerShell 2.0 帮助中有一篇关于详细信息的about_Profiles文章。简短版本(来自文档)是:

Description                Path
-----------                ----
Current User, Current Host $Home\[My ]Documents\WindowsPowerShell\Profile.ps1
Current User, All Hosts    $Home\[My ]Documents\Profile.ps1
All Users, Current Host    $PsHome\Microsoft.PowerShell_profile.ps1
All Users, All Hosts       $PsHome\Profile.ps1

Name                               Description
-----------                        -----------
$Profile                           Current User,Current Host
$Profile.CurrentUserCurrentHost    Current User,Current Host
$Profile.CurrentUserAllHosts       Current User,All Hosts
$Profile.AllUsersCurrentHost       All Users, Current Host
$Profile.AllUsersAllHosts          All Users, All Hosts
Run Code Online (Sandbox Code Playgroud)