Hello Vishnu,
Using an RDP connection file you can set the
alternate shell to be your application, and you pass that as a command-line argument to mstsc.exe. the typical rdp file syntax is like
screen mode id:i:2
desktopwidth:i:1280
desktopheight:i:1024
session bpp:i:16
winposstr:s:0,1,0,0,1280,819
compression:i:1
keyboardhook:i:2
displayconnectionbar:i:1
disable wallpaper:i:0
disable full window drag:i:0
allow desktop composition:i:1
allow font smoothing:i:1
disable menu anims:i:0
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:srv001.mycompany.com
audiomode:i:0
redirectprinters:i:0
redirectcomports:i:0
redirectsmartcards:i:0
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:C:\Windows\Notepad.exe
shell working directory:s:C:\
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
drivestoredirect:s:I:;
For example lets say your connection file name is withNotepad.rdp and it is stored in C:\RDPCONS then you run
mstsc.exe C:\RDPCONS\withNotepad.rdp
Note :- Please note that when such a program is closed on remote desktop then you won't be able to access the regular explorer shell.
Regards,