about_Execution_Policies

Posted Chuck Lu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了about_Execution_Policies相关的知识,希望对你有一定的参考价值。

https://technet.microsoft.com/en-us/library/hh847748.aspx?f=255&MSPPError=-2147217396

在powershell中执行命令

Get-ExecutionPolicy -List

 

此命令也可以使用tab键进行辅助

Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined

 

 

查询指定的Scope的ExecutionPolicy

 Get-ExecutionPolicy -Scope CurrentUser

 Get-ExecutionPolicy CurrentUser

 

 

CHANGE YOUR EXECUTION POLICY
 ------------------------------
    To change the Windows PowerShell execution policy on your
    computer, use the Set-ExecutionPolicy cmdlet. 

    The change is effective immediately; you do not need to restart
    Windows PowerShell. 

    If you set the execution policy for the local computer (the default)
    or the current user, the change is saved in the registry and remains
    effective until you change it again.

    If you set the execution policy for the current process, it is 
    not saved in the registry. It is retained until the current
    process and any child processes are closed. 

    
    Note: In Windows Vista and later versions of Windows, to run
          commands that change the execution policy for the local
          computer (the default), start Windows PowerShell with the
          "Run as administrator" option.
    

    To change your execution policy, type:
 
        Set-ExecutionPolicy -ExecutionPolicy <PolicyName>

    For example: 

        Set-ExecutionPolicy -ExecutionPolicy RemoteSigned



    To set the execution policy in a particular scope, type:

        Set-ExecutionPolicy -ExecutionPolicy <PolicyName> -Scope <scope>

    For example: 

        Set-ExecutionPolicy RemoteSigned -Scope CurrentUser


    A command to change an execution policy can succeed but
    still not change the effective execution policy.

    For example, a command that sets the execution policy for
    the local computer can succeed but be overridden by the 
    execution policy for the current user.
    

示例:

 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

设置完成后,可以用上面的命令进行查看

 

以上是关于about_Execution_Policies的主要内容,如果未能解决你的问题,请参考以下文章

无法加载文件 XXX 因为再此系统上禁止运行脚本。有关详细信息,请参阅 XXX 中的 about_Execution_Policies

无法加载文件 XXX 因为再此系统上禁止运行脚本。有关详细信息,请参阅 XXX 中的 about_Execution_Policies

无法加载文件 XXX 因为再此系统上禁止运行脚本。有关详细信息,请参阅 XXX 中的 about_Execution_Policies

cmd 无法加载文件进行数字签名。无法在当前系统上运行 该脚本。有关运行脚本和设置执行策略的详细信息, about_Execution_Policies

vue 3 没有全局安装

PowerShell~执行策略的介绍