Batch file to login to putty and list directory

I've created a .bat file with this line:

start C:\USERS\Putty\putty.exe -ssh user@server.com -pw password

That opens a putty session and logged in it with the user and password i've already specified. But now, I want to enter a simple command like "ls -l" for example.. How can I do that?
I've also tried plink...The line in that case is this one:

start C:\USERS\Putty\plink.exe -v -ssh user@server.com -pw password -m UNIX_commands.txt

and in that file "UNIX_commands.txt" I've added the following lines:

cd /projects/test
ls -l

all works fine (the commands are executed) but i can't see the putty session... all i can see is the verbose in my DOS windows of the last line "ls -l"...
The putty session vanishes away. How can I have the session opened and list the mentioned directory.
Please help
Regards
Nirmal

---------- Post updated 02-04-11 at 09:44 AM ---------- Previous update was 02-03-11 at 01:05 PM ----------

Hi All,

Can some one please help me with this.

Regards
Nirmal

That's what plink does. plink isn't putty.

You could put that in your .profile file (on the server, that is) so it always happens automatically when you log in.

By the way, you agreed not to bump posts when you registered here.

1 Like

Thanks for the reply..

Using putty.exe itself can I have the .bat file login and go to my directory(not without altering the .profile)?

Nope.