是否有Windows 10 PowerShell等同于Linux Bash的.bashrc? [英] Is there a Windows 10 PowerShell equivalent to .bashrc for Linux Bash?

查看:84
本文介绍了是否有Windows 10 PowerShell等同于Linux Bash的.bashrc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每次打开电源外壳时默认运行一些命令.Bash有一个.bashrc文件,它在启动时作为源运行.有没有办法使用powershell做到这一点?

I want to run some commands by default every time I open up power shell. Bash has a .bashrc file that it runs as source when it starts up. Is there a way to do this with powershell?

推荐答案

如Dai在评论部分中所指出的,

As pointed out by Dai in the comment section, Powershell Profiles sound like the closest equivalent to the .bashrc file.

PowerShell配置文件是在PowerShell启动时运行的脚本.您可以使用配置文件作为登录脚本来自定义环境.您可以添加命令,别名,函数,变量,管理单元,模块和PowerShell驱动器.您还可以将其他特定于会话的元素添加到您的个人资料中,以便每个会话中都可以使用它们,而无需导入或重新创建它们.

A PowerShell profile is a script that runs when PowerShell starts. You can use the profile as a logon script to customize the environment. You can add commands, aliases, functions, variables, snap-ins, modules, and PowerShell drives. You can also add other session-specific elements to your profile so they are available in every session without having to import or re-create them.

这篇关于是否有Windows 10 PowerShell等同于Linux Bash的.bashrc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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