是否可以将 $profile 的默认值更改为新值? [英] Is it possible to change the default value of $profile to a new value?

查看:28
本文介绍了是否可以将 $profile 的默认值更改为新值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我不想在这里创建我的配置文件:

So I would rather not create my profile file here:

C:\Users\fmerrow\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

我的意思是不要误会我的意思,这不是世界末日,我可以忍受.但是,我喜欢让我的文档"根目录保持合理精简,而且我真的不想每次开始使用新应用程序时都在那里创建一个目录.

I mean don't get me wrong, this isn't the end of the world and I can live with it. However, I like to keep root "My Documents" reasonably lean and I really would rather not create a directory there every time I start using a new application.

我四处寻找可能隐藏此设置的位置,但到目前为止没有运气.它似乎不在注册表或任何 $PsHome 文件中.

I've nosed around looking to where this setting might be hidden, but so far no luck. It doesn't seem to be in the registry or any of the $PsHome files.

我是否只需要学会忍受它?...或者有没有办法改变 $profile 的值,它会一直粘"在这个系统上?也就是要改变$profile的默认值"?

Do I just have to learn to live with this? . . . or is there a way to change the value of $profile that will "stick" on this system for all time? That is, to change the "default value" of $profile?

到目前为止我想到的最好的方法是忽略 $profile 而是将一些代码放在 $profile.AllUsersAllHosts 中以从哪里获取/执行我的文件我想把它而不是从默认的 $profile 位置.

The best I've thought of so far, is to ignore $profile and instead put some code in $profile.AllUsersAllHosts to source/execute my file from where I want to put it instead of from the default $profile location.

欢迎评论和/或其他建议.

Comments and/or other suggestions welcomed.

弗兰克

推荐答案

我认为您在现有配置文件中获取新"配置文件的解决方案可能与您将要获得的一样好.

I think your solution to source your "new" profile in the existing profile is probably as good as you're going to get.

这篇关于是否可以将 $profile 的默认值更改为新值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆