PowerShell该术语未被识别为cmdlet函数脚本文件或可运行程序 [英] PowerShell The term is not recognized as cmdlet function script file or operable program

查看:488
本文介绍了PowerShell该术语未被识别为cmdlet函数脚本文件或可运行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Powershell中实现脚本并收到以下错误。场景截图正是我输入的内容以及由此产生的错误。

I am implementing a script in powershell and getting the below error. The sceen shot is there exactly what I entered and the resulting error.

在此路径上有我从此处获取的文件Get-NetworkStatistics.ps1。我会按照其中的步骤进行操作,尽管会出现错误。

At this path there is file Get-NetworkStatistics.ps1 which I got from here. I am following the steps from it, though there are errors.

推荐答案

您首先必须对脚本进行点化,因此为您服务:

You first have to 'dot' source the script, so for you :

. .\Get-NetworkStatistics.ps1

第一个点要求PowerShell将脚本文件加载到您的PowerShell环境,而不是启动它。您还应该使用 set-ExecutionPolicy Unrestricted set-ExecutionPolicy AllSigned 参见(执行政策说明)。

The first 'dot' asks PowerShell to load the script file into your PowerShell environment, not to start it. You should also use set-ExecutionPolicy Unrestricted or set-ExecutionPolicy AllSigned see(the Execution Policy instructions).

这篇关于PowerShell该术语未被识别为cmdlet函数脚本文件或可运行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆