該組織已更改我的「主」服務器位置,並對其進行了配置,以便我無法在%USERPROFILE%\ Documents文件中找到文件。但是,當我啓動PowerShell時,它仍然指向以前的服務器以查找某些重要變量。我該如何改變這一點?如何更改配置文件相關的路徑變量?
PROFILE \\OLDSERVER\USERS\lit\My Documents\WindowsPowerShell\Microsoft.PowerShell_prof...
PSCommandPath \\OLDSERVER\USERS\lit\My Documents\WindowsPowerShell\profile.ps1
PSScriptRoot \\OLDSERVER\USERS\lit\My Documents\WindowsPowerShell
這是PSVersion 5.0.10586.117在Windows 7
PS H:\My Documents> $profile | get-member -type noteproperty
Name MemberType Definition
---- ---------- ----------
AllUsersAllHosts NoteProperty string AllUsersAllHosts=C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost NoteProperty string AllUsersCurrentHost=C:\Windows\System32\WindowsPowerShell\v1.0\Microso...
CurrentUserAllHosts NoteProperty string CurrentUserAllHosts=\\OLDSERVER\USERS\lit\My Documents\WindowsPowe...
CurrentUserCurrentHost NoteProperty string CurrentUserCurrentHost=\\OLDSERVER\USERS\lit\My Documents\WindowsP...
PS H:\My Documents> "$Env:USERPROFILE, $Env:HOMEPATH"
C:\Users\lit, \Users\lit
[參閱about_Automatic_Variables](https://technet.microsoft.com/en-us/library/hh847768 .aspx):'$ PSCommandPath'和'$ PSScriptRoot'在當前正在運行的腳本中定義。什麼說'$ profile | get-member -type noteproperty'? – JosefZ