2012-02-16 9 views
1

PowershellでCOMオブジェクトを使用してクリアケースビューを作成しようとしています。CAL mkviewコマンドが失敗する

$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 

これを解決する手助けがありますか? ' $variable 'リターン" $variable "リターン変数にasign値を使用して文字列$変数 を使用して

$ct.CmdExec("lsview $ViewName") 

$ct.CmdExec("mkview -tag $ViewName -nsh $ViewFullpath") 

答えて

2

は、これらの行を変更してください。 (upvoted)に追加するには、キリスト教の答えを

$ViewFullpath="$ccViews$ViewName.vws" 
2

、私が見つけた技術情報は、単純な引用符を使用しています:swg1PK70509

$ct.CmdExec('lsact -fmt `'%[crm_state]p`' 

はあなたのコードでは、あなたもこれを変更することができ、これを語りましたしかし変数を使用する場合は、 "how to find root [folder] for each component using cleartool?"のように二重引用符が必要です。

関連する問題