On the windows, I write a batch file and the following is the content. How to check it whether error or not on any step? If there is error, then threw message and stop it.
git clone xxx
cd xxx
cd build 
cmake ..
ninja install .
On the windows, I write a batch file and the following is the content. How to check it whether error or not on any step? If there is error, then threw message and stop it.
git clone xxx
cd xxx
cd build 
cmake ..
ninja install .
Use or conditional operators or errorlevel directly:
Also, do not do run multiple cd commands when you can run one.
@echo off
git clone xxx && echo Success || echo Git failed & exit /b 1
cd /d "xxx\build" && echo Success || echo unable to CD & exit /b 1
cmake .. && echo cmake Success || echo cmake failed & exit /b 1
ninja install . && echo Success || echo ninja install error & exit /b 1
to use errorlevel directly, using a single example and also demonstrating pushd and popd instead of cd:
@echo off
git clone xxx
if errorlevel 1 echo Error occurred & exit /b
pushd "xxx\build"
echo run other commands
popd