Run cmake with batch file and double click

I write a batch file to install lib.
If I run it install.bat on command prompt. It can generate the release folder.

But I try to double click the install.bat. It will not generate the release folder.

Here is this install.bat batch file

cmake -G "Visual Studio 16 2019" ^
		-S ./ ^
		-B ./build-release ^
		-DCMAKE_BUILD_TYPE=release ^
cmake --build build-release --config release
cmake --install build-release --config release --prefix ../release

Double clicking doesn’t really have a current working directory defined AFAIK. I recommend adding a cd to the right directory in there.

Sorry, I don’t know how to use cd on this sample.
Because I use --prefix to assign the install path.

Use this at the beginning of your batch:
PUSHD %~dp0

Also consider adding a


call at the end of the script so that the windows stays open so you can see any errors that may occur (or revel in your success!)