How to escape quote marks in Exec Command in MSBuild

前端 未结 2 1298
臣服心动
臣服心动 2021-01-30 15:47

I\'m trying to build an MSBuild script that maps a network drive to a drive letter in the script, but unfortunately the path to the target folder includes an embedded space. Th

相关标签:
2条回答
  • 2021-01-30 16:04

    You can use single quotes for command ,e.g.

      <Exec Command='explorer.exe "$(DestinationDir)"' IgnoreExitCode="true" />
    

    (From MSBuild exec task without blocking)

    0 讨论(0)
  • 2021-01-30 16:11

    Use &quot; to encode the double quotes that you want net to see inside the Command attribute value :

    <Exec Command="net use x: &quot;\\ofmapoly703\c$\program files\ar\iap&quot; /user:$(UserID) $(Password)" 
    WorkingDirectory="c:\" 
    ContinueOnError="false" 
    /> 
    
    0 讨论(0)
提交回复
热议问题