简体   繁体   English

在“ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force”之后还原回PowerShell

[英]Revert Back PowerShell after “Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force”

Since i need to update npm manually using npm-windows-upgrade , 由于我需要使用npm-windows-upgrade手动更新npm

i put 我放

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

setting into my PowerShell. 设置到我的PowerShell中。

Now i already finished updating npm , so i need to return the PowerShell setting to previous state, ie rollback the Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force , how to do that? 现在我已经完成npm更新,因此我需要将PowerShell设置返回到以前的状态,即回滚Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force ,该怎么做?

您可以通过get-executionpolicy获取当前的执行策略,因此可以将该状态保存在变量中,以后再用于重置状态。

$ep = get-executionpolicy set-executionpolicy $ep

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用多个命令和Set-ExecutionPolicy Unrestricted -force制作.ps1文件? - How to make a .ps1 file with multiple commands and Set-ExecutionPolicy Unrestricted -force? 使用PowerShell脚本为数百个用户提供Set-ExecutionPolicy - Set-ExecutionPolicy for hundreds of users with PowerShell script Windows 7 上的 PowerShell:为普通用户设置执行策略 - PowerShell on Windows 7: Set-ExecutionPolicy for regular users 如何为 Set-Executionpolicy 创建 Powershell 别名 - How to create a Powershell Alias for Set-Executionpolicy 运行 `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` 是否安全 - Is it safe to run `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` powershell在哪里保存set-executionpolicy设置? - Where does powershell saves the set-executionpolicy setting? 最近使用 Set-ExecutionPolicy 在 Powershell 中的回声是否发生了变化? - Did echo change in Powershell with Set-ExecutionPolicy recently? 运行任何Powershell脚本时出现Set-ExecutionPolicy错误 - Getting Set-ExecutionPolicy error while running any powershell script Set-ExecutionPolicy -ExecutionPolicy RemoteSigned 的安全风险 - Security risks of Set-ExecutionPolicy -ExecutionPolicy RemoteSigned 将CurrentUser的ExecutionPolicy设置为Unrestricted是否违反安全性? - Is setting ExecutionPolicy to Unrestricted for CurrentUser a security breach?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM