麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > PowerShell > 正文

PowerShell因為在此系統中禁止執行腳本的解決方法

2020-10-29 20:56:08
字體:
來源:轉載
供稿:網友

在Powershell直接腳本時會出現:

無法加載文件 ******.ps1,因為在此系統中禁止執行腳本。有關詳細信息,請參閱 "get-help about_signing"。
所在位置 行:1 字符: 17
+ E:/Test/test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException

ps1的內容:

在powershell中執行 set-ExecutionPolicy RemoteSigned

下圖可以看到原來是無法運行對的,執行了上面的命令后就可以了,如下圖

查看“get-help about_signing”:

主題
about_signing

簡短說明
說明如何對腳本進行簽名以使其符合 Windows PowerShell 執行策略。

詳細說明
Restricted 執行策略不允許任何腳本運行。
AllSigned 和 RemoteSigned 執行策略可防止 Windows PowerShell 運行沒有數字簽名的腳本。

本主題說明如何運行所選未簽名腳本(即使在執行策略為 RemoteSigned 的情況下),還說明如何對
腳本進行簽名以便您自己使用。

有關 Windows PowerShell 執行策略的詳細信息,請參閱 about_Execution_Policy。

允許運行簽名腳本
-------------------------------
首次在計算機上啟動 Windows PowerShell 時,現用執行策略很可能是 Restricted(默認設置)。

Restricted 策略不允許任何腳本運行。

若要了解計算機上的現用執行策略,請鍵入:

get-executionpolicy

若要在本地計算機上運行您編寫的未簽名腳本和來自其他用戶的簽名腳本,請使用以下命令將計算機上的
執行策略更改為 RemoteSigned:

set-executionpolicy remotesigned

有關詳細信息,請參閱 Set-ExecutionPolicy。

執行“set-ExecutionPolicy RemoteSigned ”:

執行策略更改
執行策略可以防止您執行不信任的腳本。更改執行策略可能會使您面臨 about_Execution_Policies
幫助主題中所述的安全風險。是否要更改執行策略?
[Y] 是(Y) [N] 否(N) [S] 掛起(S) [?] 幫助 (默認值為“Y”): y

Run a CMD batch file

To run a batch script from the CMD shell, save the file as plain ASCII text with the file extension .CMD, then from the command line, enter the name of the script and press return.

C:/Batch> Demo.cmd

To run a batch file from within another batch file, use the CALL command, otherwise the first script will exit without performing any further commands.

It is also possible to run batch scripts with the old (Windows 95 style) .BAT extension, but be aware that these will set ERRORLEVEL differently.

Run a Powershell script
To run a PowerShell script from the CMD shell:

復制代碼 代碼如下:

C:/> powershell -file "c:/batch/demo.ps1"

Run a VBScript file

To run a VBScript from the CMD shell:

復制代碼 代碼如下:

C:/> cscript c:/batch/demo.vbs

“The method of the enterprising is to plan with audacity and execute with vigor” ~ John Christian Bovee

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 一区二区国产在线 | 手机在线看片国产 | 欧美一级特级 | 视频一区二区精品 | 国产高潮国产高潮久久久91 | 欧洲黄视频 | 国产精品999在线观看 | 国产91av视频 | 国产精品一区2区3区 | 国产一级毛片国产 | 欧美性受xxxxxx黑人xyx性爽 | 久久久电影电视剧免费看 | 亚州欧美视频 | 国产女同玩人妖 | 久久久久久久久久久久久久av | 久久青草热 | 九色com| 国产一级毛片高清视频 | 成人福利在线播放 | 久久久久久久黄色片 | 噜噜在线视频 | 亚洲第一精品在线 | 99日韩精品视频 | 99精品在线视频观看 | 久久网站热最新地址4 | 亚洲精品日韩色噜噜久久五月 | 密室逃脱第一季免费观看完整在线 | 免费福利在线视频 | 福利免费观看 | 久久精品国产久精国产 | 中文字幕激情视频 | 国产在线精品区 | 国产精品久久久久久久久久久久久久久 | 免费看成人av| 国产午夜精品一区二区三区嫩草 | 欧美性生活视频免费 | 国产69精品久久久久孕妇黑 | 香蕉视频18 | 久久96国产精品久久秘臀 | 久久av喷吹av高潮av懂色 | 操毛片 |