Common Macros for Build Commands and Properties

说明

https://docs.microsoft.com/en-us/cpp/ide/common-macros-for-build-commands-and-properties?view=vs-2017

$(ProjectDir)      The directory of the project (defined as drive + path); includes the trailing backslash '\'.

$(SolutionDir)    The directory of the solution (defined as drive + path); includes the trailing backslash '\'.

$(TargetDir)       The directory of the primary output file for the build (defined as drive + path); includes the trailing backslash '\'.

 

example

https://stackoverflow.com/questions/6267788/making-pre-and-post-build-event-scripts-pretty

考虑用powershell脚本接收参数,然后打印出来确认

在项目属性中,找到Build Events

 

然后点击Edit Post-build,点击Macros就可以看到对应到的具体的变量的Value

 

 

如何去掉backslash

https://stackoverflow.com/questions/36975106/how-can-i-remove-tralling-backslash-from-projectdir

You can use the TrimEnd function to trim the trailing slash character

$(ProjectDir.TrimEnd('\'))

I found this option in this post

 

https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/

posted @ 2016-09-03 17:58  ChuckLu  阅读(253)  评论(0编辑  收藏  举报