I have an exe file that runs graphics tests on startup, i.e. The application window with multiplayer opens, tests are run and the window closes. If this is done locally, then everything goes fine, but if you run it by connecting via ssh, then the application appears in the task manager, but not in interactive mode, i.e. windows do not open multiplayer is not visible and naturally the tests do not pass. I tried to do the same with the native Paint application or calc.exe:"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk", "C:\windows\system32\calc.exe"Through the command line locally, everything works, a window opens and a service appears in the task manager, and if you run it by connecting via ssh, then only the service appears. Run commands for the exe file are sent through jenkins, which is connected via ssh to the windows machine. What needs to be done to be able to run an application interactively on a remote display under windows?

  • Answer # 1

    So far I decided to implement it through the task scheduler SCHTASKS, for calculator calc.exe=):

    set HH=%time:~0.2%
        set /a allmm=%HH%*60+%MM%+2
        set /a hh=%allmm%/60
        set /a mm=%allmm% "%" 60
        set hhmm=%hh%:%mm%
        echo hhmm=%hhmm%
        echo time=%time:~-0.5%
        SCHTASKS /Create /ST %hhmm% /SC ONCE /TN calc_test /TR C:\windows\system32\calc.exe /F
    /ST %hhmm% -Task start time. This option must be used in conjunction with /SC ONCE
    /SC ONCE -Specifies the schedule and frequency of the task.
    /TN calc_test -Task name
    /TR C:\windows\system32\calc.exe -Path to the executable file
    /F -Force execution, in this case (job creation)
    %hhmm% -a variable with a time value obtained by adding 2 minutes to the start time of the command `%time%`

    As a result, I received a scheduled task that will be completed in at least 1 minute, at most 2 minutes, but in interactive mode:

    >SCHTASKS /Query /TN "calc_test"
        TaskName Next Run Time Status
        calc_test 11/02/2022 16:57:00 Ready

    This is the time until the task is completed:

    >echo %time%

    After completion task:

    >SCHTASKS /Query /TN "calc_test"
        TaskName Next Run Time Status
        calc_test N/A Ready

    If desired, you can add task deletion:

    >SCHTASKS /Delete /TN "calc_test" /F

    If anyone knows a more elegant solution to the issue, I will be glad to hear and learn from experience. Thank you