Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape quote marks in Exec Command in MSBuild

Tags:

msbuild

Use " 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" 
/> 

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

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

(From MSBuild exec task without blocking)