Update README.md
clarification
typo
Brendan Kidwell
13 May 2020
https://github.com/bkidwell/rdp-sized
On Windows, I want an RDP client with the following features:
I've tried the mstsc.exe
built into Windows, and I've tried some alternative clients. mstsc.exe
gets me most of the way there, but I just need a way to easily set a client window size in the connection .rdp
file and make it stick; it's easy to lose a custom window size if you use mstsc.exe
's graphical connection editor.
My solution is a couple of Windows .cmd
batch scripts that wrap mstsc.exe
and provide appropriate command line parameters for the behavior I want.
Let's assume you have a 1920×1080 display, about 15 inches, and you want to use Windows "125%" scaling. You probably have a taskbar set at a certain size, and you want all the remaining desktop area to be taken by the RDP client windows.
There are two scenarios, depending on the server environment:
Or, if the pixels on your display aren't too dense for your eyes, if you want "100%" scaling:
rdp-sized.cmd
in this package reads the client window height from the filename of the connection file being launched, and automatically sets the width to match -- based on an if/else tree. It passes the appropriate parameters into Windows own mstsc.exe
RDP client.
rdp-edit.cmd
is a quick workaround to make it easy to edit an .rdp
file in mstsc.exe
after you've changed the desktop config to specify that rdp-sized.cmd
is the default handler for .rdp
files.
You might already have a personal bin
or scripts
folder with little utilities which is listed in your Windows %PATH%
environment variable. If so, copy rdp-sized.cmd
and rdp-edit.cmd
there. Otherwise, create a %USERPROFILE%\scripts
folder, put the two scripts in there, and add that folder to your %PATH%
environment variable now.
You'll want rdp-sized.cmd
to be your default handler for .rdp
files. To do that, find or create an .rdp
file now, right-click on it, select "Open with → Choose another app". Navigate to and select rdp-sized.cmd
as the target, and make sure you mark "Always use this app for .rdp files", then click "OK". You can terminate the RDP client connection that gets launched now, and proceed to the next step.
Now that you've changed the default handler for .rdp
, there isn't a convenient way to launch an .rdp
file in mstsc.exe
in Edit mode. To fix that, open up your "SendTo" folder. Click Start → Run, and execute the command shell:sendto
. Create shortcuts here for rdp-sized.cmd
and rdp-edit.cmd
.
Editing the SendTo menu like this is a global operation for your login profile -- the two scripts' shortcuts will appear in SendTo for ALL file types. There are cleaner ways of doing the installation, but they are beyond the scope of this quick guide.
Finally, you're ready to configure your client window sizes.
Remember, the .rdp
file's filename specifies the window height. This is matched to a desired width in rdp-sized.cmd
, and passed into mstsc.exe
as a command line parameter, and it will override any client window size that was set the last time you edited and re-saved the file using mstsc.exe
.
To change the permanent window size preference for an .rdp
file:
.rdp
file like foo--HEIGHT.rdp
, where HEIGHT
is an integer number of pixels. There must be two hyphens ("--") preceding the HEIGHT
number.rdp-sized.cmd
, lines 30 through 33. Change the series of if-else statements there and make sure every height you would use in a filename has a corresponding width in this block of code..rdp
file with rdp-sized.cmd
and see if it came out to the right fit. Re-edit the filename and the script until you get it right.Don't forget that the scripts here can't set the client-side scaling for the RDP connection, in the case where you aren't allowed to set it on the server end! Each time after you launch the .rdp
file, if you don't want to use "100%" scaling, you need to right-click the client titlebar and set the scaling to the your desired value.