的值 automatic $PROFILE variable is the true location of your profile file ,更准确地说是 当前用户 (您)和 当前主机 (托管 PowerShell 的应用程序,通常是控制台/终端窗口)的配置文件的真实位置。
p1
p2
只是 PowerShell doesn't create any profile files by default, and it doesn't even create the directories for them .
p4
if (-not (Test-Path $PROFILE)) { New-Item -Force $PROFILE }
The Test-Path call guards against accidentally replacing an existing profile, because New-Item -Force not only creates parent directories as needed, but also replaces any existing file with a new, empty one.