Powershell第一步

如果在Win7中要想运行Powershell脚本或者Command,必须要用Set-ExecutionPolicy,一般来说开发用Bypass是比较合适的:

Set-ExecutionPolicy -ExcutionPolicy Bypass -Force

 

Syntax

Set-ExecutionPolicy [-ExecutionPolicy] {<Unrestricted> | <RemoteSigned> | <AllSigned> | <Restricted> | <Default> | <Bypass> | <Undefined>}
 [[-Scope] {<Process> | <CurrentUser> | <LocalMachine> | <UserPolicy> | <MachinePolicy>}] 
[-Force] 
[-Confirm] 
[-WhatIf] [<CommonParameters>]

Parameters

-ExecutionPolicy <ExecutionPolicy>

Specifies the new execution policy. Valid values are:

-- Restricted: Does not load configuration files or run scripts. "Restricted" is the default execution policy.

-- AllSigned: Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.

-- RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.

-- Unrestricted: Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.

-- Bypass: Nothing is blocked and there are no warnings or prompts.

-- Undefined: Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy that is set in a Group Policy scope.

 

-Scope <ExecutionPolicyScope>

Specifies the scope of the execution policy. The default is LocalMachine.

Valid values are:

-- Process: The execution policy affects only the current Windows PowerShell process.

-- CurrentUser: The execution policy affects only the current user.

-- LocalMachine: The execution policy affects all users of the computer.

 

-Force

Suppresses all prompts. By default, Set-ExecutionPolicy displays a warning whenever you change the execution policy.

-Confirm

Prompts you for confirmation before executing the command.

 

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值