一、在用户所在的文档目录中创建一个名为“WindowsPowerShell” 的目录
例如:
C:\Users\silence\Documents\WindowsPowerShell
二、在WindowsPowerShell的目录下创建一个名为“profile.ps1”的配置文件,内容为:
Set-Location C:\Users\silence # 后面是你设置的启动目录
三、管理员启动powershell 在命令行界面下输入以下命令
set-executionpolicy remotesigned
选择是
y
以使windows允许执行自定义脚本
也可以通过相似的步骤添加powershell 7 for .net core的配置文件
关于powershell 5 for .net firmwork以及powershell 7 for .net core的安装路径和配置文件的路径, 参考微软文档:
https://docs.microsoft.com/zh-cn/powershell/scripting/install/migrating-from-windows-powershell-51-to-powershell-7?view=powershell-7
转载于:https://blog.51cto.com/silencezone/2374627
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)