powershell - 如何安装 PSCX Powershell 模块?

标签 powershell powershell-2.0

我正在运行安装了 PowerShell 2 的 Windows 7。

我从这里下载了 2.1 版 - http://pscx.codeplex.com/releases

发行说明说

  • 解封 zip 文件 - {我做了}
  • 将 ZIP 文件的内容提取到 $env:Home\Documents\WindowsPowerShell\Modules 文件夹

  • 我不确定 $env:Home 是什么,经过一番搜索确定发行说明需要一个名为 Home 的环境变量,但我的机器上不存在该变量。

    多一点搜索说使用定义为 ~在我的机器上。所以在 PS 提示符下我运行 cd ~
    我机器上的哪个导致了网络驱动器 U:
    我创建了以下目录 U:\Documents\WindowsPowerShell\Modules并将提取的 Pscx-2.1.0 复制到 Modules 文件夹中。打开 PowerShell 提示符并输入 Get-Module -ListAvailable .这并没有在结果中给我 Pscx。

    上面的步骤实际上给了我这个文件夹树U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\Pscx-2.1.0
    所以我将文件复制了一个级别并再次尝试 U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\并尝试使用 U:\Documents\WindowsPowerShell\Modules\Pscx\
    我还用这条路径尝试了以上所有方法 U:\WindowsPowerShell\Modules\Pscx-2.1.0\
    我猜模块实际上不应该在这个目录中,所以更多的搜索会导致这个命令。 (Get-ChildItem Env:\PSModulePath).Value
    这给出了以下结果
    C:\Users\my.name\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    所以我把Pscx-2.1.0文件夹复制到这里C:\Users\my.name\Documents\WindowsPowerShell\Modules\Pscx-2.1.0
    仍然没有运气。

    我错过了什么步骤?

    最佳答案

    我实际上并没有完全完成上述问题的最后一步,结果证明是答案。

    这是完整性的答案

  • 解封已下载的 zip 文件
  • 解压 zip 文件 - 这可能会给出 Pscx-2.1.0/Pscx-2.1.0/{lots of files} 的文件夹结构
  • 将子文件夹重命名为 Pscx - 即 - Pscx-2.1.0/Pscx/{lots of files}
  • 在 Powershell 提示符下运行 (Get-ChildItem Env:\PSModulePath).Value并记下模块文件夹位置。
  • 复制 child Pscx folder到上面给出的 Modules 文件夹位置。
  • 在 Powershell 提示符下运行 Get-Module -ListAvailable 以查看可用的 Pscx 模块。
  • 关于powershell - 如何安装 PSCX Powershell 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13755082/

    相关文章:

    rest - Powershell正在吞噬REST错误响应

    windows - 在 Windows 批处理文件中的多个命令中使用 powershell 变量

    powershell - 带破折号的引用命令名称

    powershell - 合并多个文件中的所有内容,找到匹配的字符串并获取每行的计数

    powershell - DynamoDB API 过滤扫描不返回任何结果

    powershell - 加密证书必须包含数据加密或 key 加密

    powershell - 如何正确传递参数?

    powershell - -in 运算符在 2.0 版本中不起作用?

    csv - 重建 CSV 并使用字段值作为导出的文件名

    xml - XML通过保存到文件中丢失双引号