'How to create a texstudio-user command that executes a CMD file by calling its absolute path that has spaces and passes arguments to it?

I have a *.cmd to be called by texstudio to which I pass two arguemtns: tex file name (%) and the engine (lualatex)

In texstudio, when I try to execute the cmd file by defining the user command by

cmd.exe /C "C:\Users\Diaa\Desktop\New folder\BuildExamV2.cmd" % lualatex

enter image description here

I end up with the following error

C:\Users\Diaa\Desktop\New' is not recognized as an internal or external command, operable program or batch file.

However, without passing the arguments (i.e. by omitting % lualatex from the definition), the cmd file is executed properly without issues.

So, how to call it properly in texstudio with passing the arguments % lualatex?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source