スペースを含むラベルを使用して、powershell を使用して srcSafe から「取得」しようとしています。
スペースを含むパラメーターをexeに渡す方法についての多数の投稿のように見えるものを読みましたが、試したことはありません。私の問題は、ラベルを正しく提供しているようです。
以下は、コマンドラインバージョンです(動作します)。
ss get $/sandbox/TestSSCmdLine/* -R -I-N -VL"label space"
私の最も単純なpowershellバージョンは次のとおりです。
ss get '$/sandbox/TestSSCmdLine/*' -R -I-N '-VL\"label space\"'
powershell コマンドを実行すると、ファイルが取得されず、$lastexitcode が「100」になります。
Echo args は、私が正しいと思うものを示しています。
Arg 0 is <get>
Arg 1 is <$/sandbox/TestSSCmdLine/*>
Arg 2 is <-R>
Arg 3 is <-I-N>
Arg 4 is <-VL"label space">
Powershell ISE は同じことを示しています。
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Raw argument string: get $/sandbox/TestSSCmdLine/* -R -I-N "-VL\"label space\""
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Argument 0: get
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Argument 1: $/sandbox/TestSSCmdLine/*
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Argument 2: -R
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Argument 3: -I-N
DEBUG: NativeCommandParameterBinder Information: 0 : WriteLine Argument 4: -VL"label space"
物事を混乱させるために、 start-process が機能しているようです:
$cmd = "ss.exe"
$args = "get", '$/sandbox/TestSSCmdLine/*', "-R", "-I-N", '-VL"label space"'
$proc = start-process $cmd $args -Wait -NoNewWindow -PassThru -WorkingDir $pwd
$proc.ExitCode
追加の紛らわしい項目は、echo args がバージョン パラメーターを次のように表示するという事実です: Arg 4 is <-VLlabel space> -> スペースがないことに注意してください。
助けてくれてありがとう!
ジョン・A.