PowerShell コマンドにスペースを含む RunProgramスペースを含む文字列をロードするとエラーが発生するため、二重引用符で囲む必要があります。
Names Default to Here(1);
parameter_A = "this has spaces";
parameter_B = "specific.domain.com";
command = "program -Name \!"" || parameter_A ||"\!" -Path \!"" || parameter_B || "\!"";
write(command );
// outputs the expected:
// program -Name "this has spaces" -Path "specific.domain.com"<BR />
add_result = RunProgram(
Executable( "powershell.exe" ),
Options( {"/c", command } ),
ReadFunction( "text" ));The parameter_A breaks the execution as it thinks there are more arguments passed. Yet, the command works if I copy and paste the output of write in powershell.
私には何が欠けているのでしょうか?
高度な統計モデリング消費者および市場調査データのブレンディングとクリーンアップRe: PowerShell コマンドにスペースを含む RunProgramここでは、 Windows コマンド ラインがなぜ使いにくいのかを徹底的に説明します。引用符は実際には私たちが考えているような働きをしません。
理解しやすいので、あなたがやったように、アポストロフィと引用符を混ぜます。
Re: PowerShell コマンドにスペースを含む RunProgramこれは、同様のケースで以前に役に立ちました: Run Program アプリケーションに引用を渡す
escapedquote = "\!\\!"";
Re: PowerShell コマンドにスペースを含む RunProgramNames Default to Here(1);
parameter_A = "this has spaces";
parameter_B = "specific.domain.com";
command = "powershell "\!"program -Name '" || parameter_A ||"' -Path '" || parameter_B || '"\!"";
write(command );
// outputs the expected:
// powershell "program -Name 'this has spaces' -Path 'specific.domain.com'"
add_result = RunProgram(
Executable( "cmd.exe" ),
Options( {"/C", command } ),
ReadFunction( "text" ));これは私にとってはうまくいきましたが、一重引用符を使用しないより良い解決策があるかどうかはわかりません。