Самодельный командлет Restart-Profile
PS C:\Users\user> Restart-Profile
D:\Мои : The term 'D:\Мои' 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 t
he path is correct and try again.
At line:1 char:1
+ D:\Мои документы\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\Мои:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\user> $profile
D:\Мои документы\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
В общем, кроме очевидного пути переименовать папку "Мои документы" в что-то без пробела, есть еще варианты?
man about_profiles
Не работает:
PS C:\Windows\system32> man about_profiles
Get-Help : Get-Help could not find about_profiles in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the T
echNet library at http://go.microsoft.com/fwlink/?LinkID=107116.
At line:55 char:7
+ Get-Help @PSBoundParameters | more
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
+ FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand
Update-Help тоже не выходит, судя по всему из-за того, что выход в инет только через прокси.
For example, the Windows PowerShell console supports the following basic
profile files. The profiles are listed in precedence order. The first
profile has the highest precedence.
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
The profile paths include the following variables:
- The $PsHome variable, which stores the installation directory for
Windows PowerShell.
- The $Home variable, which stores the current user's home directory.
Не могу понять, чем мне это поможет. Как его переместить из этой директории ($Home\[My ]Documents\WindowsPowerShell\Profile.ps1) в другую?
Updated: 18 April 2017, 11:21:23
А-а, вот у меня вот это как раз:
In addition, other programs that host Windows PowerShell can support their
own profiles. For example, Windows PowerShell Integrated Scripting
Environment (ISE) supports the following host-specific profiles.
Description Path
----------- -----
Current user, Current Host $Home\[My ]Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
Но что делать, по прежнему непонятно.
shs, сама переменная $HOME и не содержит, собственно:
PS C:\Users\user> $HOME
C:\Users\user
Содержит папка Мои документы:
PS C:\Users\user> $profile
D:\Мои документы\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
Которая перемещена из дефолтового расположения на диск D.
Ну и в это случае, возвращаемся к первому посту:
В общем, кроме очевидного пути переименовать папку "Мои документы" в что-то без пробела, есть еще варианты?
Updated: 18 April 2017, 12:01:51
Т.е. вопрос, как бы изменить путь для переменной $profile.
и вообще забей на
Цитата: Retif от Сегодня в 12:49:52
Restart-Profile
Ну это была самодельная функция перезагрузки профиля, сейчас её поменяли с учетом "& $profile", теперь всё ок, вопрос решен, спасибо :beer:
Updated: 18 April 2017, 13:58:45
Было
Invoke-Command -FilePath $profile