Putty/KITTY logon bat script

Over the years, I have used SecureCRT, but the companies always
paid for it.  Recently, I was thinking about purchasing it for my
personal use, but WOW – sticker shock ($$price$$).

So, I have continued using PUTTY. In the past, I have made some
basic BAT files (lab use only), and lately have been trying PuttyCM
and MTputty
(I like a lot) for tabbed windows.

Last week, I was inspired by Sgobo's
thread
(Lab Login Script - linux
)
and
Daniel's Blog for a Putty logon script – windows
.

 

I finally found the solution for my own labs (mulitple devices).  KITTY is a fork (variant) of Putty for Windows and it extends some features
to the command-line.

So, last weekend I worked on a script....and it is awesome for my use. 
If I have only 15-30 minutes......presto.....I am logged on
automatically, and my windows are laid out for me.   
It is so nice to be
able to quickly test out something that I need to prove/proof.  Logon to the lab .......  test/experiment/practice  ...... and
cleanup/log off . Done.

 

BELOW is the absolute bare bones of my  BAT script (1 of a 2-section-lab):

====script below=========================

@echo off

cd C:PUT-DIRECTORY-PATHkitty

@REM     Remember that Kitty is putty (extended). Just Change the
name to putty.exe, for puttyCM or other putty programs.

 

@REM    if there is NOT a common password for all devices, remove
the following two lines

echo FOR AUTO-LOGIN--please type or paste your LAB PASSWORD:

set /p passvar=

 

start "1" kitty.exe -load "PUT PUTTY DEVICE 1 NAME HERE" -pass %passvar%  -xpos  25  -ypos  0
timeout /T 2 > nul


start "2" kitty.exe -load "PUT PUTTY DEVICE 2 NAME HERE"  -pass %passvar%  -xpos  0  -ypos  150
timeout /T 2 > nul

start "3" kitty.exe -load "PUT PUTTY DEVICE 3 NAME HERE"  -pass %passvar%   -xpos  25  -ypos  315
timeout /T 2 > nul

PAUSE

@REM ;   NOTES below

@REM ;   username is already in putty settings for the device

@REM ;   NO adjustments to Windows Environment necessary

@REM ;  JUST REPEAT ABOVE  start  LINES FOR OTHER DEVICES
@REM ;  SAVE AS .BAT FILE
@REM ;  ADJUST the -xpos  and -ypos to get the correct positions. 

@REM ;  Oh yeah! I forgot.       Yo' Mama is so fat.......

 

====script above=========================

 

This JPEG is of my laptop.   My console windows are probably bigger than most people have them.   But I like to read debugs and output quickly without so many word-wraps.

***  The color coding, I already had done in PUTTY.    Grey for routers. Default for Switches.  Guess which color for firewalls.  ;-)

JPEG of   Section-I  of   Two Section Script

Comments

  • JoeMama,

    Nice work. Thanks for sharing. Although I have heard of KITTY in this forum already, I have never tried to use, I think it is good time now to do some experiments.

    I have always used Putty and PuttyCM for tabbed Putty, but looks like this one adds more capabilities and has more features. Therefore, I will check it out.

    Thanks once again for sharing!

    Regards-

  • Is kitty tabbed?

    edit: Oh, I see that mtputty is a wrapper for putty or kitty, so I guess not.  Tabs FTW - having a dozen+ ssh/telnet windows open all day blows.

  • JoeMJoeM ✭✭✭

    No.   Kitty is just Putty.

    The Window managers (tabbed) that I am aware of are puttyCM   and  MTputty   (I like this one. It is being updated).

    Just rename Kitty.exe to Putty.exe.....for these programs.   It will look just like putty.

     

    another little tool that  KITTY (putty) has that is interesting.......is a script/notepad......Shift+F2   This is not super big for me, but it is there at a keystroke.

     

    EDIT:    In a work environment, I usually prefer tabs -- for a cleaner desktop environment.

    But for labs, I realize that I really enjoy using  ALT-TAB to rotate quickly between windows   -- as well as being able to see more than one window at a time  SIDE-by-SIDE (i.e. debugs, noticing change/alerts/updates).    I will still use MTputty for some things.....after all KITTY is PUTTY.  ;-)

  • Hi,

    I am able to open the window using this:


    start "3" kitty.exe -load "PUT PUTTY DEVICE 3 NAME HERE"  -pass %passvar%   -xpos  25  -ypos  315

     

    How can I put a "grep ....filename" in the batch file ?

     

    Thanks

  • JoeMJoeM ✭✭✭

    -load 

    This particular command in Putty (kitty) will load a profile that is already created in the Putty (kitty) client.

    It is possible to connect directly to a device without a device profile.  In that case, do not use -load  in the command.

     

    EDIT:   I have never used grep in a window's bat file.

    I found this link for the supposed Windows equivalant for grep.  FindStr

    http://scripthacks.wordpress.com/2008/09/16/grep-equivalent-for-windows-string-parsing/

Sign In or Register to comment.