Jump to content
Sign in to follow this  

pass command line parameters to run Putty

Recommended Posts



I am trying to implement launching Putty with AutoIt.

I have Putty configuration session I named it 'testcom11'. It saves Putty session with com11 and baudrate and so on.

I implemented in AutoIt line as :

Run ("putty -load testcom11")

It works fine. I was able to launch Putty with my session and Putty windows pops up and I was able to type 'AT' command to putty window.

Now I want , instead of to hard coded one session, to pass session from command line like this :

myAutoItprogram.exe testcom11

I put in AutoIt line :

$cmp = $CmdLine[1]

I can see it passed correctly when I print ( diplay in , let's say, MsgBox) $cmp it shows testcom11.

In next line I have :

Run ("putty -load $cmp")

However AutoIt launches Putty only with window asking me to load session. So clearly
it didn't read -load $cmp option.

As you can see I am novice to AutoIt, so if you can see if it is something with how it handles $cmp in Run Window or something else.

Thank you in advance,

Share this post

Link to post
Share on other sites


Welcome to the autoit forum :)

The variables are not interpreted like in PHP whenever they are in a string.

Please have a look at the help file, or debug your script with a MsgBox or ConsoleWrite to see that it's not working the way you want.

Run("putty -load " & $cmp)
NB: use autoit code tags to post your code ;)

Br, FireFox.

Edited by FireFox


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


Share this post

Link to post
Share on other sites

Hi FireFox,

Thank you so much .

Run("putty -load " & $cmp) did a trick  :)
I tested today . it works the way I want.
I am happy  :)
Thank you again.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.