Is it possible to set the working directory for a "Custom Build Step" command in a Visual Studio 2008 C++ project?
Asked
Active
Viewed 3,891 times
1 Answers
7
I don't know if you can set a default working directory but you can change it yourself in your custom build step.
In the Property Pages dialog for the file with the custom build step, select the Command Line field and click the ...
button:
In the Command Line dialog, you can add multiple commands that all will be executed for the custom build. To change the working directory to C:\MyFolder and launch MyProgram.exe located in that folder, add the following lines:
An alternative is to define all this in a bat file such as MyCustomBuild.bat and call it in the Command Line field: call MyCustomBuild.bat

Daniel Hedberg
- 5,677
- 4
- 36
- 61
-
Spent so much time searching google, and solution is so simple :) Thanks a lot – Beetle Feb 27 '13 at 15:41
-
1cd now also supports changing the dive. You can now do: `cd /D c:\MyFolder` or as the working directory seems to C:\ `cd /D $(ProjectDir)`is very helpful, too. – Morty Jan 25 '18 at 16:33