【问题标题】:Import Carbon Powershell Module from shared folder从共享文件夹导入 Carbon Powershell 模块
【发布时间】:2014-01-22 16:18:53
【问题描述】:

我使用的是 Powershell Remoting 2.0 版。
我已经下载了Carbon Powershell 模块。我把它复制到共享文件夹中:

\SharedServer\PowershellModules\Carbon-1.0.0

在我的脚本 ps1 中,我有这个源代码:

$PSPathCarbon = "\\SharedServer\PowershellModules\Carbon-1.0.0\Carbon"
. (Join-Path $PSPathCarbon Import-Carbon.ps1)

我收到以下错误:

术语 '\SharedServer\PowershellModules\Carbon-1.0.0\Carbon\Import-Carbon.ps1' 未被识别为 cmdlet、函数、脚本文件的名称,或 可运行的程序。检查名称的拼写,或者路径是否 包含,请验证路径是否正确,然后重试。

有什么建议吗?

【问题讨论】:

    标签: powershell import module


    【解决方案1】:

    试试:

    . (Join-Path $PSPathCarbon 'Import-Carbon.ps1')
    

    或者:

    . "$PSPathCarbon\Import-Carbon.ps1"
    

    【讨论】:

    • 它说你需要 64 位版本的 powershell。你有吗?当您运行 Test-Path "$PSPathCarbon\Import-Carbon.ps1" 时,您得到的是真还是假?也试试这个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-26
    • 2019-09-16
    • 2012-02-15
    相关资源
    最近更新 更多