Putty Macro Script



  • This page contains download links for the latest released version of PuTTY. Currently this is 0.74, released on 2020-06-27. When new releases come out, this page will update to contain the latest, so this is a good page to bookmark or link to.
  • Wanting to run a macro/script from PuTTY We currently use TUN as an emulation program to connect to various unix applications. I am looking at moving to PuTTY release 0.60 but am getting stuck as one application runs a macro at startup to run a program.
  • I'm new to excel macro, and I have this big requirement to complete. Connect to putty through excel macro - the login details should betaken from cells in excel. Run few commands in putty - these commands also will be added in the excel macro. Results of the commands needs to be displayed in the excel.

Home |FAQ |Feedback |Licence |Updates |Mirrors |Keys |Links |Team
Download: Stable ·Snapshot |Docs |Changes |Wishlist

This page contains download links for the latest released version ofPuTTY.Currently this is 0.74, released on 2020-06-27.

I have created button and want that when ever I click on that button then putty connect to the server in activecell using my macros. Here is Vba script Sub Button1Click Dim RetVal RetVal = Shell('C: Program Files PuTTY putty.exe -ssh -l username ', 1 & ActiveCell) End Sub.

Script

When new releases come out, this page will update to contain thelatest, so this is a good page to bookmark or link to.Alternatively, here is apermanent link to the 0.74 release.

Release versions of PuTTY are versions we think are reasonably likelyto work well. However, they are often not the most up-to-dateversion of the code available. If you have a problem with thisrelease, then it might be worth trying outthe development snapshots,to see if the problem has already been fixed in those versions.

Package files

You probably want one of these. They include versions of all thePuTTY utilities.

(Not sure whether you want the 32-bit or the 64-bit version? Read theFAQ entry.)

32-bit:putty-0.74-installer.msi(or by FTP)(signature)
64-bit:putty-64bit-0.74-installer.msi(or by FTP)(signature)
.tar.gz:putty-0.74.tar.gz(or by FTP)(signature)

Alternative binary files

The installer packages above will provide versions of all of these(except PuTTYtel), but you can download standalone binaries oneby one if you prefer.

(Not sure whether you want the 32-bit or the 64-bit version? Read theFAQ entry.)

32-bit:putty.exe(or by FTP)(signature)
pscp.exe (an SCP client, i.e. command-line secure file copy)
64-bit:pscp.exe(or by FTP)(signature)

Putty Macro Script Commands

psftp.exe (an SFTP client, i.e. general file transfer sessions much like FTP)
64-bit:psftp.exe(or by FTP)(signature)
32-bit:puttytel.exe(or by FTP)(signature)
plink.exe (a command-line interface to the PuTTY back ends)
64-bit:plink.exe(or by FTP)(signature)
pageant.exe (an SSH authentication agent for PuTTY, PSCP, PSFTP, and Plink)
64-bit:pageant.exe(or by FTP)(signature)
puttygen.exe (a RSA and DSA key generation utility)
64-bit:puttygen.exe(or by FTP)(signature)
32-bit:putty.zip(or by FTP)(signature)
Putty macro script pastebin

Documentation

HTML:Contents page
Zipped HTML:puttydoc.zip(or by FTP)

Putty Macro Script Tutorial

Windows HTML Help:putty.chm(or by FTP)

Source code

.tar.gz:putty-0.74.tar.gz(or by FTP)(signature)
.zip:putty-src.zip(or by FTP)(signature)
Clone:https://git.tartarus.org/simon/putty.git

Downloads for Windows on Arm

Compiled executable files for Windows on Arm. These are believed towork, but as yet, they have had minimal testing.

64-bit Arm:putty-arm64-0.74-installer.msi(or by FTP)(signature)
32-bit Arm:putty-arm32-0.74-installer.msi(or by FTP)(signature)
64-bit Arm:putty.exe(or by FTP)(signature)
64-bit Arm:psftp.exe(or by FTP)(signature)
64-bit Arm:plink.exe(or by FTP)(signature)
64-bit Arm:puttygen.exe(or by FTP)(signature)
32-bit Arm:pscp.exe(or by FTP)(signature)
32-bit Arm:puttytel.exe(or by FTP)(signature)
32-bit Arm:pageant.exe(or by FTP)(signature)
Putty Macro Script
Zip file of all Windows on Arm executables
32-bit Arm:putty.zip(or by FTP)(signature)

Checksum files

MD5:md5sums(or by FTP)(signature)
SHA-256:sha256sums(or by FTP)(signature)
CommandsIf you want to comment on this web site, see theFeedback page.
(last modified on Sun Nov 22 22:28:56 2020)

PuTTY doesn't need any introduction as its one of the widely remote console utilities. PuTTY is an SSH and telnet client.

Putty Macro Script

Although use the console is already simple and easy you are most likely to make mistakes sometimes (and erase the project folder accidentaly). You can automate your server tasks without type all that you need everyday (go to a folder, do something there, then exit, navigate to other etc).

Make it easy for you and your team. In this article, you'll learn how to execute a shell script from windows to a remote server using PuTTY and the windows command prompt.

Creating a .sh file

Typically a .sh file is a shell script which you can execute in a terminal. This file format is commonly used for Unix shell files, created by the Unix shar utility program.

How safe is it?

You may find it weird that you must perform another task manually in order to execute a file. But this is partially because of strong need for security.

Basically when you download and run a bash script, it is the same thing as somebody telling you 'run all these commands in sequence on your computer, i promice that results will be good'. Ask yourself if you trust the party that has supplied this file, ask yourself if you are sure that have downloaded the file from the same place as you thought, maybe even have a glance inside to see if something looks out of place (although that requires that you know something about *nix commands and bash programming).

Conclusion : execute only commands that you know , and only if you know how they work.

To get started, create a file somewhere with .sh extension (command_file.sh) somewhere. Then, write some shell script.

In this example (the most basic), we are going to print the date in the Putty console.

That was , really easy isn't?.

If you want , start creating your own, the following example shows a basic interaction with commands that you normally execute using putty (subversion command svn update):

Note: as is your first time creating a .sh file to be executed, be sure of what do you to prevent any damage that you can do to your server. We recommend you to test only with the previous script and when you have more experience, try with your own.

Start reading more about all the things that you can do with .sh files in your server. Now that our script is ready, we just need to learn how to execute it automatically.

Executing the script using PuTTY from the windows command prompt

Now that your script file is ready and (theoretically) you know what you want to achieve with it, we just need to execute it and save many precious time.

The structure of the command is the following:

The -m option expects to be given a local file name, and it will read a command from that file.
With some servers (particularly Unix systems), you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers. In particular, it is known not to work with certain ‘embedded’ servers, such as Cisco routers.
This option is not available in the file transfer tools PSCP and PSFTP.

The entire command can be executed on the command prompt (cmd.exe) in windows easily, e.g:

Note : instead of use the full path to the putty executable, you can define an environment variable for putty in windows and then use it as %putty%.

Open the cmd.exe and execute the command replacing respectively the credentials and parameters :

Finally, after the execution of your command in the cmd.exe , putty will be opened and your script will be executed as we made with the first example, the date of the server will be printed in the console :

Tip : you can create an interface using another language like C# to automate even more with a single click

Have fun .

Capture putty output (optional)

If your bash script is not straight-forward (it can generate output with information about errors, information etc), you may want to save the content to analyze it when the script execution is closed.

As putty normally closes the console if there's no statement that pause it when the last line of your script is executed and there's no way to redirect the output (but achievable with plink utility), we need to specify this task to the PuTTY application.

1) Open putty, click on the top icon and select change settings.

2) Click on Logging item in the right side list. Now select the All session output option button in the Session loggin area.

Finally, choose a path to putty.log file in your system and click on apply.

All the output generated by putty will be written in this log file.