Make PowerShell ignore semicolon

后端 未结 6 2392
清歌不尽
清歌不尽 2021-02-19 06:54

I want to execute a cmd on PowerShell and this command uses semicolons. Then PowerShell interprets it as multiple commands. How do I make PowerShell ignore the semicolons and ex

6条回答
  •  囚心锁ツ
    2021-02-19 07:06

    Just escape the semicolon on the command line:

    msbuild /t:Build`;PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Debug`;_PackageTempDir=$TargetFolder $WebProject
    

    I do this all the time with the tf.exe utility:

    tf.exe status . /r /workspace:WORK`;johndoe
    

    FYI, this issue has been heavily voted up on Connect. PowerShell v3 addresses this issue with the new --% operator:

    $env:TargetFolder = $TargetFolder
    msbuild $WebProject --% /t:Build;PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Debug;_PackageTempDir=%TargetFolder%
    

提交回复
热议问题