Jenkins devenv build not finishing because next command starts

Jenkins setup:
OS: Windows 10 Pro 64bit
Visual studio 2010 installed
JDK: OpenJDK 64-Bit Server VM Temurin-11.0.15+10

The devenv command that is part of Visual Studio returns immediately without waiting for its tasks to complete. More information and some alternatives are listed on Stack Overflow: