@echo off rem RunKeyShotRemoteDesktop.cmd rem Copyright (C) 2019, David C. Merritt, david.c.merritt@siemens.com rem rem This program is free software: you can redistribute it and/or modify rem it under the terms of the GNU General Public License as published by rem the Free Software Foundation, either version 3 of the License, or rem (at your option) any later version. rem rem This program is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rem GNU General Public License for more details. rem rem You should have received a copy of the GNU General Public License rem along with this program. If not, see . rem rem --------------------------------------------------------------------- rem rem Batch script to run KeyShot in a remote dekstop session. rem rem ------------------ rem *** TO INSTALL *** rem ------------------ rem rem 1. Copy this script on to the remote workstation which has KeyShot rem installed to it. rem rem 2. Edit this script where indicated to define the full path to the rem KeyShot exe file rem rem -------------- rem *** TO USE *** rem -------------- rem rem 1. Remote desktop in to the workstation with KeyShot installed to it rem rem 2. Run this script that we have previously coped ot the remote rem workstation rem rem 3. The script will disconnect the active remote desktop session but rem leave the user logged in on the remote workstation rem rem 4. The script will then launch the KeyShot exe on the remote but now rem disconnected session rem rem 5. After a few seconds of being disconnected, allowing some time for rem KeyShot to fully launch, then remote desktop back into the rem workstation rem rem VoilĂ ! KeyShot is now running remotely. rem rem rem --------------------------------------------------------------------- rem rem 30/04/2019 merritt initial release rem 01/05/2019 merritt added title to window rem rem ******************************************************************* rem Define the full command line to run the KeyShot exe file below here rem ******************************************************************* set ProgramCmdLine="C:\Program Files\KeyShot7\bin\keyshot.exe" rem ******************************************************************* rem Define the full command line to run the KeyShot exe file above here rem ******************************************************************* rem set the window title title Start KeyShot from RDC rem set command line for tasklist.exe used to help identify our current desktop session id set IdentifySessionIdCmd=tasklist /FI "IMAGENAME eq tasklist.exe" /FO "TABLE" /NH rem run tasklist.exe and capture the remote session id from the output for /f "tokens=4 delims= " %%i in ('%IdentifySessionIdCmd%') do set SessionId=%%i rem forewarn the user of disconnect and pause so user can aknowledge this echo. echo We are about to connect back to the remote system display. echo This will automatically disconnect your Remote Desktop session. echo This is expected and is no cause for alarm. echo Please allow time for KeyShot to fully launch on the remote system. echo Then reconnect your Remote Desktop session and use KeyShot. echo. pause rem connect our remote session back to the running desktop console tscon %SessionId% /dest:console rem now we are disconnected launch KeyShot start "" %ProgramCmdLine% rem be a good citizen and clean up after ourselves and exit quietly set ProgramCmdLine= set IdentifySessionIdCmd= set SessionId= exit /b