This script works for me from a Windows RDP session:
echo Remote Desktop will be temporarily disconnected. Please reconnect after a few seconds.
REM The active session has an arrow as the first character
FOR /F %%A in ('qwinsta') do (
if "!tempSessionName:~0,1!"==">" (
tscon.exe !tempSessionName:~1! /v /dest:console
echo Starting Cura . . .
call "C:\Program Files\Ultimaker Cura 4.1\Cura.exe"
Caveat: it needs to be run elevated to connect back to the console. I don't know how this will work on a server hosting multi-user RDP sessions.
This StackExchange post explains the problem adequately:
As mentioned in that answer, perhaps you could write a script that closes the RDP connection and then launches Cura
Link to post
Share on other sites