Run automated testing from command line

How do you run the command line in your jenkins pipeline? using the bat command?
I have this:

stage( "UnitTests" ) {
    try {
        bat "\"${env.UE_ROOT_FOLDER}\\Engine\\Binaries\\Win64\\UE4Editor-Cmd.exe\" \"${env.WORKSPACE}\\${env.PROJECT_NAME}.uproject\" -ExecCmds=\"Automation RunTests ${env.PROJECT_NAME}\" -unattended -nopause -testexit=\"Automation Test Queue Empty\" -log -log=RunTests.log"
    } catch ( Exception e ) {
    }
}

but before the editor tries to run the unit tests, I have this error:

[2018.11.06-18.45.01:561][  0]LogD3D11RHI: Error: D3DRHI->GetFactory()->CreateSwapChain(DXGIDevice, &SwapChainDesc, SwapChain.GetInitReference()) failed 
at D:\Build\++UE4\Sync\Engine\Source\Runtime\Windows\D3D11RHI\Private\Windows\WindowsD3D11Viewport.cpp:126 
with error 887A0022

I guess that’s because the editor is created in the bat process and does not have a chance to create the RHI (I tried with -NullRHI, with the same error)