问题描述
我正在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函数脚本文件或可运行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!