Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio postbuild - changing to the solution drive

In Visual Studio postbuild, I need to run a batch file. The solution is potentially on a different drive to that which Visual Studio is running from. In postbuild, how do I determine the drive letter that the solution is running from so I can change to that drive before running the batch file? At the moment, all I have is this:

CD $(ProjectDir)
$(ProjectDir)postbuild.bat

The problem is that changing directory when that directory is on a different drive does not change the current directory, as you have to manually change which drive you're on, e.g. like so:

E:\
CD $(ProjectDir)
$(ProjectDir)postbuild.bat

I can't guarantee what drive the solution is going to be on though, so I need to determine the drive via some kind of macro to ensure the postbuild.bat file will run from the currect location.

like image 603
Nathan Ridley Avatar asked Nov 21 '09 16:11

Nathan Ridley


1 Answers

CD /D $(ProjectDir)
like image 75
Roger Lipscombe Avatar answered Nov 10 '22 09:11

Roger Lipscombe