Putty, the Command Line and NO clicky clicky

The power of the command line

I believe that you should only use the mouse when you don’t know what are doing. That is why graphical interfaces exist. If you have a repetitive task, then clicking the same thing over and over shows that you are poor engineer. You need to take control of your tools to work in the smartest way.

PuTTY is a fine example of having both options. You can clicky-clicky all you want and waste hours of of your life pushing your mouse around the screen. Or you can run a lot of the repetitive PuTTY actions from the command line.

But first thing is to introduce to using the keyboard to get around Windows and open the DOS box. It always surprising how so few people know that Windows can actually be driven using the keyboard and very rarely need to use the mouse.


You need to note the directory that you installed PuTTY to, something like this would be the default.


and now we are ready to go:


Start PuTTY

So, we are ready to start PuTTY, click start, and PuTTY menu will be clearly displayed.


So lets create a telnet session for a device in our network by entering the details, entering a name in the Saved Sessions box and the clicking on the Save button


Getting to grunter

So normal people would click on Start, All Programs, PuTTY, PuTTY, Click grunter and the Open.

Lot of clicking for not much gain I would say.

Starting Windows programs on the Command Line

You can start just about any program in Windows from the commad line. I am always surprised by how many people don’t know this. Lets look at starting Windows Notepad from the CLI. That is, from a DOS box, just type the command “notepad” and the away it will go.


None of this clicky clicky business.

But we can make this even faster.

Fastest Way to open the the command line ….

The fastest way to open the Windows Start box is to press Control-Escape which will open the Windows Start menu (as if you had clicked on the Start button).

Then press the “r” key (for Run), and type “cmd” and the Windows DOS box (or whatever you choose to call it) will open on your screen.


Fastest way for Notepad would be ….

If you are thinging laterally, you would realise that the fastest way to open Notepad would be:

  • press Command-Escape (together)
  • press R
  • type “notepad”
  • and press enter

Ok, now we are starting to get much quicker at getting things done.

Where’s PuTTY ?

So you might think that it would be very easy to just type PuTTY using the same technique. But alas, it does not. Give it a go and do something like this:


you will get…..


It’s all about system paths

MS Windows uses a concept of paths to go searching for where programs are located on your hardware. When using the DOS box, the operating system has no context about where your programs are located on the hard drive. When using the GUI, the information about where the program is located, is contained in the Shortcut that you are clicking on.

You could start PuTTY by typing something like this:


but that is too much typing for me.

We can tell Windows that the directory where the PuTTY program is and to look in there for the program as needed.

To the Control Panel System tab then

In the Control Panel, System Properties, select the Environment Variables button at the bottom:


and then select Path in the System Variables section, and press the Edit button.


and it will look like this ( you need to be a little bit careful here not to delete the content, if you think you have mis-types then just press escape and start over), on the end of the line enter the following text exactly (including the semi colon):
;C:Program FilesPuTTY


This set the path variables to include the PuTTY program directory in the search path. You only have to do this once. Windows will set the the Environment Variable permanently from now on.

You will need to logout at this point, or restart. The Path Variables are only read once at boot time.

When you come back, open the DOS box again (Ctrl-Escape, R, cmd, Enter – just to remind you), and type path to confirm the variables are in place.


Alrighty then, lets try that again

Ctrl-Escape, R (for run), PuTTY


and we get PuTTY opening just like we were doing clicky-clicky all day.


Ahh, the speed and the comfort!! Can you feel that ?

But you’re right, I want even less clicking…..

BUT, I still have to click on grunter and then open with my mouse hand. Is strikes me that PuTTY was built by people who are really CLI centric so there would have to be options for doing more.

Sure enough. In Section 3.8 of the Help file, cleverly titled “The PuTTY command line” we get the following details.

To start a connection to a server called host:

putty.exe [-ssh | -telnet | -rlogin | -raw] [user@]host

If this syntax is used, settings are taken from the Default Settings (see section 4.1.2); user overrides these settings if supplied. Also, you can specify a protocol, which will override the default protocol (see section

For telnet sessions, the following alternative syntax is supported (this makes PuTTY suitable for use as a URL handler for telnet URLs in web browsers):

putty.exe telnet://host[:port]/
In order to start an existing saved session called sessionname, use the -load option (described in section

putty.exe -load “session name”


Even better is this bit -load: load a saved session

The -load option causes PuTTY to load configuration details out of a saved session. If these details include a host name, then this option is all you need to make PuTTY start a session.

You need double quotes around the session name if it contains spaces.

So now I can open a DOS box (Ctrl-Escape, R, cmd, Enter – just to remind you again), then type:


YES! Freedom from the mouse!

A little review then

If you spend all day connecting to equpment, you need to get the connection done as fast as possible. Spending all your life clicky-clicky on the cute little mousey is just distracting you from the task at the hand. It just not geek enough, and you need to be hardcore.

This technique shows a really fast way to get connected to your devices. It works best for SSH devices although it does, kind of support telnet, just not very well.

You can now use the Windows Command Line to connect directly to a SSH host by using this syntax:

putty.exe -ssh [email protected]

or you can use telnet

putty.exe telnet://

You will need to spend some time learning the keyboard shortcuts that I talked about. Pretty quickly they will become second nature and you will have even more speed and confidence as you move around your network.

More options

This really is only just the start of what can do with PuTTY, and there are lots more things. If you have a favorite then please contact me using the contact form or put something in the comments and I would be pleased to add it or write it up.

Other Posts in A Series On The Same Topic

  1. Putty - Fixing Right Click Paste (9th January 2011)
  2. Putty, the Command Line and NO clicky clicky (5th October 2009)
  3. Putty - Recommended Default Settings for a Network Engineer (21st September 2009)
  4. Setting the Defaults for PUTTY (20th September 2009)
  • MCL.Nicolas

    Nice one greg !! It’s true sometimes clicking is just so slow 😉

  • Patrick

    i use “launchy” http://www.launchy.net/ for fast shortcut start (Putty, SAP, Outlook) etc.
    Nice, but not so nice as Quicksilver :-)

    • http://etherealmind.com Greg Ferro

      Does launchy allow you to specify the host that you wNt to connect to ? Or does it let you just start putty ? If not, I would suggest that this technique is better ?

      • Patrick

        no problem

        press alt and space putty or only “pt” worked fine!

        • http://etherealmind.com Greg Ferro

          Most companies don’t allow the install of software like launchy. You are lucky to be able to.

          • IConrad

            Just an FYI — Launchy comes in “Portable” mode, which bypasses installation requirements/problems rather neatly. Just keep a flash drive with you and you don’t even have to store the files on company resources. Even if it didn’t, you could *make* it portable with 7-zip or Universal Extractor. Just extract the installer’s contents into a separate folder, do a little clean-up to remove any pointers outside of the folder, and hey-presto: portable app is portable. :)

          • http://www.akademy.co.uk/me Matthew Wilcoxson

            Actually, pressing the tab key when putty is highlighted lets you enter the command line parameters.

  • http://shivlu.blogspot.com shivlu jain

    Thank god I know all the tricks what you have told. The system path attributes could be changed with autoexec.bat file. So that during the boot process initialization occurs.

    But really its nice post.

    • http://etherealmind.com Greg Ferro

      Using autoexec has caused me problems in the past so I wouldn’t recommend this option.

  • http://reloadin10.wordpress.com reloadin10

    Even quicker then “CTRL + ESC” is “WINDOWS KEY + R”.

    I also second the use of Launchy.

    • http://etherealmind.com Greg Ferro

      Assumes that you have a keyboard with the Windows key. When using emulators or rdp, the Windows key doesn’t always work. Since I can’t rely on it, I don’t use it.

      • http://ertw.com/blog/ Sean

        Start -> Run, “R” isn’t universal — other things can get in the way.

        For example, I have remote desktop pinned to my start menu, so I would need to do “Start -> Run, R, R” because the first R takes me to remote desktop.

        Alternatively, create a shortcut on the desktop and assign a hot key to it.


        • http://etherealmind.com Greg Ferro

          two choices

          keep pressing R and it will rotate through the choices

          Rename the remote desktop shortcut so it doesn’t start with r

  • Robert

    What¥s all this enthusiasm about using putty ? Ok, i¥ve read the article:

    but hey, THATS the way a network engineer works: use Windows+R (or me to-> Launchy), type CRT and than use ALT+C or ALT+Q a lot, automatic login to often used sessions (e.g. a Jumppoint), script your login credentials -> get rid of this “no aaa authorize exec available” bullshit in PIX/ASA, and the list of the benefeit over ALL other terminal emulators goes on and on.

  • Alex

    Well if you just use FreeBSD, Solaris, Linux or MacOS as a Desktop workstation non of this junk is necessary. Installing an app just to use ssh … i mean how ridiculous is that. Microsoft *sigh*!


    • http://etherealmind.com Greg Ferro

      I’m with you, but the bulk of companies force you to use Windows, and PuTTY is more common in service providers and corporates than most people imagine. When you dint have choices, this is best worst choice.

    • Diosbejgli

      ssh is also installed as an application on your favorite linux distro, supplied in a package usually called openssh. the difference is, it’s usually installed by default in most distros. i think comparing two OSes based on this information means you are ridiculous.

    • Robert

      yeah, and the SSH Client implementation has absolutly NO comfort. You can connect and thats it. OK, scripting is available :)

      If you¥re working with several connections simultaneously and also want some extras, i bet that i¥m ten times faster done with a good program like Secure CRT

      • http://cisco.com Ruairi

        Actually, when I’m *forced* to use a windows box, I generally rename putty.exe to ssh.exe, and dump it into %WINDIR%/system32 (Or the above procedure of adding putty to your path works also). Then it’s just a quick winkey+r, followed by ssh user@host.

        Et voila!

      • Kyle

        Word.. Secure CRT has the best of both worlds…

        • http://etherealmind.com Greg Ferro

          Too expensive for many. Probably my favourite on Windows, but when you have a dozen workstations that access different things, it gets very expensive.

  • joe smith

    Alternatively you could use a MAC and put terminal in the dock, one click and you are ready to telnet or ssh right from terminal. Of course you can always make that faster by using bash aliases so you can shorten “ssh -l user my.server.com” to “my.server.com”.

  • Elliot


    If you get fed up with putty windows popping up every time you want to ssh to a machine, try out mintty.

    >> http://code.google.com/p/mintty/ OR http://freshmeat.net/projects/mintty

    I no longer use cmd.exe or putty. I have a wonderful term that provides: “xterm-compatible terminal emulation. Its features include a simple options dialog, Unicode support, drag and drop of files and folders, and window transparency.”
    Windows is usable again!

  • Alex

    OMG !

    ssh(1) + screen(1) … that’s all im going to say. i dont expect windows admins to understand.


    • http://etherealmind.com Greg Ferro

      Yep. You are quite correct.

  • Will

    Great tutorial —

    A much simpler method which I usually do as a standard on any Windows VM builds is copy the putty.exe executable into the C:windows directory and rename it to “ssh.exe”. Then I hit a start-run – type ssh x.x.x.x and viola — I open a ssh session to the host I want. As long as the default sessions settings are set to the connection type SSH then you are good. I usually use the built in telnet client in windows or SecureCRT when telnet is needed.

  • Robert

    I’m a die hard putty user but my network has hundreds of systems that I have log into. Putty connection manager is the way to go on this one. I created a database with that is laid out with folders that I can navigate through to find the box I need to connect to. This is the antithesis of of what this article is all about.

    For my quick and dirty connection I use cygwin ssh. Works just like the linux version. And as for my Windoze laptop, good ol’ kermit to the rescue. It also does zterm transfers for copying up IOS images, that is if you don’t have the thumb-drive available.

    • http://etherealmind.com Greg Ferro

      A suprising number of companies do not allow you to install extra software, so I haven’t attempted to cover non-core features of PuTTY.

    • http://twitter.com/SyntaxTerror Ian Triggs

      I will agree here.  I have to connect to a possible couple of hundred devices across the fleet.  Putty will not do and neither will the command line.  PuttyCM is the best thing since sliced bread.

      Also a comment to Greg, that OS in your screenshots is almost 12 years old.  I know you’re not a Windows guy but Windows 7 is a whole lot more productive than XP.  You could’ve just pressed the start menu key on your keyboard once (or clicked it), typed in the word ‘putty’ and pressed enter and it would’ve launched.  Even if it wasn’t even installed and the exe was lying around somewhere on the HDD, and without any environment variables.

      • http://etherealmind.com Etherealmind

        Also, the post was published in Oct 2009 and WinXP was state of the art then. Still, no corporate company has given me a desktop with Win7 yet so it hasn’t been a problem. 

  • Victor

    I use portable version of Putty and it is called Kitty
    To start it quickly I assigned key combination on shortcut (Ctrl+Alt+T)

  • Starix

    Just thanks for such a clear tutorial!

  • Jay Paul

    Can PuTTY command line be used with VBScript to completely automate daily download of files?

  • argh

    Man, I wish I would have realized earlier, this is kind of just a silly way of running putty.
    I expected to be able to Run putty *inside* console2 or cmd prompt.

    not all is lost however, as I did go get puTTy finally, and I happened to read the part about plink.

    plink [email protected]

    no one wants to use puTTy’s ugly interface do they? No WAY!!
    so I don’t look like so much of a dick, to the people seeing this in the future. oh yeah “Hi” :) <3
    I am going to tell you how to do it.


    get a free shell account:

    add, plink to path
    path C:where-ever-you-put-plink
    plink -P 30 shellmix.com

    then you can make an account
    and log into it again on 22 by doing:

    plink [email protected]

    or maybe you have ssh enabled on your trusty dd-wrt:

  • srpter

    You missed a lot of good flags

    -pw myPassword
    logging in right from the cmd

    putty userName@gunther -pw myPass

    or running a file of commands

    -m c:pathtofileoflinuxcommands.txt

  • Patrick

    Thank you! Very helpful in understanding how to automate things in my computing life!


  • Raj

    Hi All,

    I am very new to putty, every day i need to open 30+ putty sessions and need to check the running backups on the servers, i am working on a batch file to open and auto login to the putty and execute the necessary commands, i succeded to launch multiple sessions at given intervals with auto login, i am not able to change the title of the putty sessions and execute the necessary commands within the putty sessions can some one help me on this plz

    thanks in advance

    – Tadi

  • http://www.weblaminar.com Mark

    Great article……..sometimes I think I’m the only one who loves the command line. I’ve actually had managers poke fun at me because of my hardcore stance. I’m looking for a way around the lack of groups in PuTTY and this article helps. Keep’em comin…

  • Veovis Muad’dib

    @ Joe Smith:

    Or you could use Visor with Terminal.app, set terminal to launch at startup, assign ^ + ` to bring down the terminal, and alias all of your ssh sessions. Then you press ^ + `, type the name of your server, press enter, and you’re done.

    Or you could use Quicksilver to assign scripts to ssh into your servers, and launch those scripts through Quicksilver.

    Both remove the mouse entirely, as this article was attempting.

    When on Windows you could simply use Cygwin, which allows you to use OpenSSH client and daemon, and gives you a bash environment to boot.

    You could also use AutoHotKey to minimize typing even further, using either this article’s method or Cygwin.

    When on Linux there are too many options to name. (Though I wish I liked any of the Visor alternatives on Linux.)

    You could switch to another virtual terminal and set up aliases. You could use your DE’s launch mechanism. You could use AwesomeWM and barely have to use the mouse to do anything…

  • Brian Long

    I love driving from the keyboard.

    I use Bayden’s Slickrun on Windows: http://www.fiddlertool.com/SlickRun/

    I use LaunchBar on Mac OS X: http://www.obdev.at/products/launchbar/index.html

    SlickRun is FREE… LaunchBar was $10, if I remember correctly. Well worth the cost for time savings of driving everything from the keyboard.

    – Brian –

    • http://etherealmind.com Greg Ferro


      I’m also a believer n the keyboard and I’m using LaunchBar as well. Still haven’t mastered it with all it options and hooks.

      People who want something similar should look at Alfred which is free.


  • http://www.akademy.co.uk/me Matthew Wilcoxson

    One more shortcut. You can add /C or /K to cmd and it will instantly do the command when the window opens:

    e.g. cmd /Kipconfig or cmd /Cputty -load comp

    K keeps the window open.
    C closes the window after running.

  • Viettienvu

    Can I build a batch file (*.bat) to run Putty automatically?  Please help.

    • Phaniraj

      Write a batch file with the command putty -pw @. Add the parent directory path of batch file to the Path Environment variable. Then, you should be able to login to the Unix machine by typing the batch file name from run window.

  • Edward_ezy

    helpfull article!!!

    Thanks !!!

  • Viettienvu

    Is there any way to run Putty behind not showing up on the screen?

  • Daniel Challen

    I’m sure you know this, but many of your audience might not: it is not “DOS box”. Granted the syntax is largely the same, and the commands available are a super set of those found in the old DOS “command.com”, but the Windows Command Prompt (cmd.exe) is a 32 bit command-line interpreter and most certainly not DOS.

  • Withsnaveen

    I am starting the putty in windows command prompt using following command

    START putty -ssh [email protected] -pw password

    I want following things additionally
    1. open a specific location while loading  (on load i want my log location to be opened – /prod/user1/logs) 
    2. Execute a particular command  (a grep command)
    3. open Putty window with lines of scrollback 8000 (when log lines high – need to increase buffer size)

    Please help me to do the above. That will be very helpful to me

  • Rohit

    You can also call a remote putty function from inside the local machine. Just give the “C:…putty.exe -ssh IP-Address -p Port-Number -l Login-Id -pw Password”

    • http://twitter.com/CalgaryDrew Calgary Drew

      Unknown option “-p”

      • Evol Syawla

        use super putty you can create your different connections like RDP sessions and click on them, but there are other automated options you can chose. Additional info: If you set the environment variables on Win7 , no need to log out. They are immediately available.

  • Milton

    Is there a way to add to this putty.exe telnet://host:port/ an argument to make the backspace key Control-H. I know I can make the configuration change within the GUI after the connection is established, but I’d like to have that change already made.

  • Arun

    Excellent Job…!!! helped me lot. Thanks a Ton!

  • roprop

    “The fastest way to open the Windows Start box is to press
    Control-Escape which will open the Windows Start menu (as if you had
    clicked on the Start button).

    Then press the “r” key (for Run), and type “cmd” and the Windows DOS
    box (or whatever you choose to call it) will open on your screen.”

    Even faster is: WindowsKey+R

    2 keystrokes instead of 3


  • bayman

    Hi there,
    i am trying to send commands to the serial com port. manually i am able
    to do so. how can i automate it? Or is there any command which opens the
    desired comport with desires baud rate and executes user commands on
    the serial com port console?

    we can use :

    C:Program FilesPuTTY>putty.exe -serial com4 -sercfg 115200

    But this just opens the comport, what extra i need to do is to send
    commands on the opened serial port console.
    i use the following batch file:

    main.bat :

    cd C:Program FilesPuTTY
    putty.exe -serial com4 -sercfg 115200

    cscript comPort.vbs

    and here is the comPort.vbs script:

    set OBJECT=Wscript.CreateObject(“Wscript.shell”)

    Wscript.sleep 50

    OBJECT.SendKeys “dump 4096{ENTER}”

    Wscript.sleep 50

    OBJECT.SendKeys “echo abc{ENTER}”

    Wscript.sleep 50

    OBJECT.SendKeys “exit{ENTER}”

    But the cscript sends keys on the cmd prompt, i want it to be executed
    on the serial comport console.
    Can anyone please help me out on this? thanks in advance!

  • http://www.nilpo.com/ Robert Dunham (Nilpo)

    It’s even faster yet if you use the Windows Key + R to open the Run… dialog.

  • Mark Dean

    Just a thought, maybe one of the reasons a lot of folks don’t know about running stuff from the command line is you still have people who should know better calling it a “DOS box”. DOS has never been part of Windows NT (with the exception of command.com and the 16bit subsystem on 32bit versions of NT). It’s the command line or CLI or command prompt or Windows command prompt…but it ain’t a DOS box or even a DOS window. Just saying.

  • ktulu789

    First: you don’t want clicking Start/Programs/Accesories/Notepad?
    Use the new Start menu, it will show the last used programs. Set it to show 20, small icons and that will cover most of your work.

    Second: want even less clicking? Using the keyboard, perhaps? Use hotkeys! Windows has built in a useful feature: you can create a shortcut on the Start Menu or the Desktop and set a hotkey combination to it. You could go to Notepad on the Start Menu, open it’s properties, and set a hotkey like Ctrl+Alt+N, easy to use and remember.

    Third: Ctrl+Esc? Too much typing, buy a new keyboard and use the Winkey.

    Wait, what? You open the start menu to open the Run Dialog? You can make it a whole lot quicker just pressing Win+R. Or try with F, E, D too and use the damn internet to seek more useful keys, dude.

    Fiddling with paths? That’s archaic. If you like typing put all your used shorcuts on the Command starting path (usually C:Documents and settingsUser) type the first letters and press tab until it appears. Yes, DOS has autocomplete. Even better. If you reinstal Windows you just need to copy all the .lnk to the new computer, no typing of paths needed.

    All this ranting and the “technique” is full of flaws xD
    Ps: can that be called technique?

  • ktulu789

    I was looking for a way to run Putty with a single command besides /m commands.bat.

    I have an AutoIt Script to shut down the entire server network. On some I use Windows Shutdown command, on other domains I use PSshutdown, on a couple of devices like NAS and the like: Putty SSH and Linux PowerOff command. And on the virtual machines and appliances on ESXi also PowerOff command.

    I want to set a different shutdown delay for guests and hosts like

    guestA now
    guestB 60 sec
    guestC 120 sec
    HostX 200 sec

    guest1 now
    guest2 60
    Host# 130

    -m for running a batch is great, but it is just one line,/command. I just find that having lots of Commands.txt, Commandsb.txt, looks dirty.
    Is there any way to just go:
    PuTTY -ssh \guestA -u -pw -mno poweroff now
    PuTTY -ssh \guestB -u -pw -mno poweroff 60

    I just tought of setting parameters for the batch file like -m Commands.txt %1
    But it ain’t a real batch file.

    This may need quotes, how could PuTTY tell which are it’s commands and which are for the batch?

  • Gama Xul

    putty -load

    Instruction not found in entire Goddamn documentation.