Putty command line Login

Create a two files, a config file and a batch file as in below example

config.cmd

@echo off

set PATH=%PATH%;C:\PuttyFolder\
set USERNAME=username1
set PASSWORD=

set /P USERNAME=Enter Username [%USERNAME%]?
REM Password below can be seen on screen so deprecate this version and use alterntive
REM set /P PASSWORD=Enter Password [%PASSWORD%]?

REM Powershell command below **** out the password on screen.
powershell -Command $pword = read-host "Enter password" -AsSecureString ; $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword) ; [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) > .tmp.txt & set /p password=<.tmp.txt & del .tmp.txt


LoginFile1.bat

@echo off
: version 1.0
: date 06/09/2010

call config.cmd

start putty -ssh %USERNAME%@10.0.0.1 -pw %PASSWORD%
REM *** the PINGs below used to create a pause between putty opening connections **
ping 127.0.0.1 -n 2 | find "NULL"
start putty -ssh %USERNAME%@10.0.0.2 -pw %PASSWORD%
ping 127.0.0.1 -n 2 | find "NULL"
start putty -ssh %USERNAME%@10.0.0.3 -pw %PASSWORD%
  • tech-notes/scripts/putty-login.txt
  • Last modified: 2018/05/17 20:05
  • by gerardorourke