Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.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
Windows Powershell:$profile指向一个我可以';无法找到并设置永久路径_Windows_Powershell_Path_Profile - Fatal编程技术网

Windows Powershell:$profile指向一个我可以';无法找到并设置永久路径

Windows Powershell:$profile指向一个我可以';无法找到并设置永久路径,windows,powershell,path,profile,Windows,Powershell,Path,Profile,我正在查看$profile变量,发现它指向C:\users\username\Documents\windowsPowershell\Microsoft.Powershell\U profile.ps1 但是,当我尝试浏览到此目录时,找不到应该位于documents文件夹中的名为WindowsPowerShell的文件夹/目录。有什么想法吗 我希望我可以设置一个链接到我的配置文件的永久路径,或者至少在加载Powershell时加载它。我走对了吗 谢谢 -达斯汀你所看到的道路是正确的。它是用户配置

我正在查看$profile变量,发现它指向C:\users\username\Documents\windowsPowershell\Microsoft.Powershell\U profile.ps1

但是,当我尝试浏览到此目录时,找不到应该位于documents文件夹中的名为WindowsPowerShell的文件夹/目录。有什么想法吗

我希望我可以设置一个链接到我的配置文件的永久路径,或者至少在加载Powershell时加载它。我走对了吗

谢谢


-达斯汀

你所看到的道路是正确的。它是用户配置文件(控制台主机)的路径,通常看不到文件夹和文件。您可以创建它并开始使用您的配置文件-
new item-type file-path$profile-force


有关更多信息,请参见此处:

如果安装了visual studio代码,则可以通过在终端
code$PROFILE
中运行来编辑它。这将打开该文件,然后您可以对其进行编辑

现在添加在打开新终端窗口时要运行的命令,如使用“Oh My Posh”

如果您已经安装了
模块oh my posh-Scope CurrentUser

将这些行添加到您的配置文件中,以便在新的终端窗口打开时加载首选主题

导入模块oh my posh
设置PoshPrompt-主题

如果您输入命令
记事本$profile
,您会得到什么?添加术语以希望改进搜索:$profile变量为空,不存在,不存在fileYo bro,我会得到同样的错误。就像windowsPowershell是一个实际上并不存在的目录。当我输入“notepad$profile”时,会弹出一个错误,提示“系统找不到指定的路径”。