如何从模块中检索可用的命令? [英] How do I retrieve the available commands from a module?

查看:58
本文介绍了如何从模块中检索可用的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要了解计算机上可用的PowerShell模块,我使用命令

To know which PowerShell modules are available on a machine I use the command

Get-Module -ListAvailable

这将返回一个列表,其中包含模块类型,-name和导出的命令.但是导出的命令始终为空,仅显示{}.为什么未显示?

This returns a list with module-type, -name and the exported commands. But the exported commands are always empty and just displaying {}. Why is this not displayed?

我是否必须使用另一个参数,或者是否有另一个cmdlet或方法来检索可用的命令?

Do I have to use another parameter or is there another cmdlet or method to retrieve the available commands?

推荐答案

如果未加载模块,则导出的命令不可用.您需要先加载模块,然后执行获取-命令:

Exported commands are not available if the module is not loaded. You need to load the module first and then execute Get-Command:

Import-Module -Name <ModuleName>
Get-Command -Module <ModuleName>

这篇关于如何从模块中检索可用的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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