Long commands in Windows batch files can be split to multiple lines by using the ^
as mentioned in Long commands split over multiple lines in Windows Vista batc
The clear advantage of @solvingJ's method over the variants of Jeb is that it is quite obvious what happens and that there is a spatial seperation of on the left hand the ugly cmd stuff and on the right the actual content. And it can be improved in readability by putting more spaces between the left and the right part:
set CMD= docker run --rm
set CMD=%CMD% --platform=linux
set CMD=%CMD% -v %CD%:/work
set CMD=%CMD% dockcross/%IMAGE_NAME%
set CMD=%CMD% /bin/sh -c
set CMD=%CMD% "mkdir build-%IMAGE_NAME% &&
set CMD=%CMD% cd build-%IMAGE_NAME% &&
set CMD=%CMD% cmake .. &&
set CMD=%CMD% cmake --build ."
Unfortunately it is not possible to demonstrate this in a comment because multiple spaces are reduced to one there. So I do in an answer what is actually just a comment to @solvingJ's answer, which I consider the best.