Pau*_*and 13 powershell powershell-2.0
我正在运行安装了PowerShell 2的Windows 7.
我从这里下载了2.1版 - http://pscx.codeplex.com/releases
发行说明说
我不确定是什么$ 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
但仍然没有运气.
我错过了什么步骤?
Pau*_*and 11
我实际上并没有完全完成上述问题的最后一步,结果证明是答案.
这是完整性的答案
Pscx-2.1.0/Pscx-2.1.0/{lots of files}
Pscx-2.1.0/Pscx/{lots of files}
(Get-ChildItem Env:\PSModulePath).Value
并记下模块文件夹位置.Pscx folder
到上面给出的Modules文件夹位置.在PowerShell 5.0中,您可以执行以下操作:
Find-Package pscx | ? ProviderName -eq PSModule | Install-Package -Force
Run Code Online (Sandbox Code Playgroud)
-Force
如果已安装旧版本,该参数将使其升级.
在PowerShell 5.1中,您需要:
Find-Package pscx | ? ProviderName -eq PowerShellGet | Install-Package -Force
Run Code Online (Sandbox Code Playgroud)
要么
Find-Package pscx -ProviderName PowerShellGet | Install-Package -Force
Run Code Online (Sandbox Code Playgroud)
要不就
Install-Package pscx -Force
Run Code Online (Sandbox Code Playgroud)
赶紧跑
choco install pscx
Run Code Online (Sandbox Code Playgroud)
请参阅chocolatey.org获取一个单行程序以获取choco
命令.
请记住,在运行命令之前,您可能仍需要在脚本中调用它:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #allows scripts to run from the interwebs, such as pcsx
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16402 次 |
最近记录: |