Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access ProgramFilesFolder from Visual Studio post-build events

When building a C# project in Visual Studio, in the post-build events I need to call a program that is situated in C:\Program Files\\MyProgram.exe. How can I access the "C:\Program Files" folder from the post-build events?

At this link: http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx there are several Macros that can be used in the post-build events section of Visual Studio. Is there a Macro or is there a way to access the default ProgramFilesFolder path?

like image 325
rPulvi Avatar asked Jan 17 '26 02:01

rPulvi


1 Answers

Don't look for a macro, none is provided since you can also use environment variables in the pre/post-build steps. Just like you can with a .bat file, which is the way these build steps actually execute. You are probably looking for the %programfiles% environment variable. So to run that program, simply use:

  "%programfiles%\myprogram.exe"
like image 199
Hans Passant Avatar answered Jan 19 '26 20:01

Hans Passant