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

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

问题描述

我正在 powershell 中实现一个脚本并收到以下错误.屏幕截图正是我输入的内容以及由此产生的错误.

在此路径中有文件 Get-NetworkStatistics.ps1,我从 技术网库.我正在按照它的步骤操作,尽管有错误.

解决方案

您首先必须点"源脚本,所以对您来说:

<预><代码>..Get-NetworkStatistics.ps1

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

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.

At this path there is file Get-NetworkStatistics.ps1 which I got from Technet Gallery. 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

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天全站免登陆