我正在尝试使用Powershell中的COM对象创建一个clearcase视图。
$ccViews="\\Hostname.global.mycompany.com\cc-view\"
$ViewName="CodeCountView"
$ViewFullpath="$ccViews$ViewName"+".vws"
$ct = new-object -com ClearCase.ClearTool
try {
$ct.CmdExec('lsview $ViewName')
}
catch {
$ct.CmdExec('mkview -tag $ViewName -nsh $ViewFullpath')
}它抛出以下异常。
> Exception calling "CmdExec" with "1" argument(s): "storage directory
> must be in UNC style (e.g. \\host\share\...) " At
> E:\Powershellscripts\CCountAutomation.ps1:81 char:19
> + $ct.CmdExec <<<< ('mkview -tag $ViewName -nsh $ViewFullpath')
> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
> + FullyQualifiedErrorId : ComMethodTargetInvocation有人能帮我解决这个问题吗?
发布于 2012-02-16 18:08:34
尝试更改以下行:
$ct.CmdExec("lsview $ViewName")
$ct.CmdExec("mkview -tag $ViewName -nsh $ViewFullpath")使用' $variable '返回字符串$variable,使用" $variable "将值asign返回给变量。
在您的代码中,您还可以更改以下内容:
$ViewFullpath="$ccViews$ViewName.vws"发布于 2012-02-16 18:23:43
为了补充克里斯蒂安的答案,我找到的技术笔记使用了简单的引号:swg1PK70509
$ct.CmdExec('lsact -fmt `'%[crm_state]p`'但在使用变量时,需要使用双引号,如"how to find root [folder] for each component using cleartool?“所示。
https://stackoverflow.com/questions/9309121
复制相似问题