How to automatically position PuTTY terminal

PuTTY is arguably the best Windows terminal app. I’ve used it for years.

One thing that has always felt missing is the ability to automatically position it on the screen on startup. For example, I always have a couple of windows where I watch certain processes. They’re always in the same position on my screen, and always running the same scripts inside them. How do I do that?

So, you can imagine my glee when I found a patch out there that will do exactly that. Props go to Brad Goodman who wrote it. Follow that link to get both an exe (his patch applied to a 2005 build) and the source so you can patch it yourself. I’ve also put a copy of the exe here, in case his site disappears.

How to use it? Very simple.

  1. Save your session settings from inside PuTTY, as normal
  2. Start up putty-bkg.exe (instead of the usual putty.exe)
  3. Now when you load your sessions you’ll also see the new “Position & Icon” options, under “Window”:

    Enter the desired top, left (& icon, if you feel inspired)

  4. Alter them to your heart’s content (don’t forget to also adjust the rows & columns under “Window” to get it the right size too), save your session and voila.

Even more useful is if you combine this with setting a remote command to be run at initial connection.

  1. Click on “SSH” under “Connection” (you can’t do this if the session is already active)
  2. Enter the command or script you want run in the “Remote Command” textbox:

    Enter the startup command

  3. Click the “Save” button (under “Session”) as usual.

Now, to run all of the above, just setup a shortcut to:

“C:\Program Files\putty\putty-bkg.exe” -load [session name]

(where [session name] is whatever you saved your session as). Obviously adjust the path to wherever you put putty.bkg.exe.

Next time you click the shortcut, not only will PuTTY be positioned correctly on the screen, but it’ll also automatically be running whatever script you desire. Just like magic! (but with less jiggery pokery)

related

  • No Related Posts

February 9th, 2012 | Software-Engineering, Web |
  • Gene

    where can I find putty-bkg.exe ? It did not come with the installation.
    Thanks

  • Sorry, crappy css on my part (I don’t know what I was thinking). There are a coupla links in the third para that are now blindingly obvious. You can get putty-bkg from either of them.

  • garrilla

    This is neat but it’s an unsigned .exe – that’s a bit risky…

  • True.

    But what would signing do? Primarily prove identification.

    I (or Brad) could sign an exe stacked with malware.

    Given that it was a “scratch your itch” type of project for him, I doubt it’s worth the effort/cost of going through 3rd party authentication/signing (and even those aren’t foolproof, as evidenced by several high profile root cert failures of recent years).

    My suggestion would be to diff mine against his. If they’re the same, that means minimal risk of them both containing attack vectors.

    Ultimately, of course, run your own checks. Or simply don’t use it. You’re responsible for the security of your machine, after all.