Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Batch file to login to putty and list directory Post 302493527 by nirmal.mukundan on Thursday 3rd of February 2011 11:14:55 PM
Old 02-04-2011
Batch file to login to putty and list directory

I've created a .bat file with this line:
Code:
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:
Code:
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:
Code:
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

Last edited by pludi; 02-04-2011 at 04:26 AM..
 

10 More Discussions You Might Find Interesting

1. Linux

resticting user to login using putty on port 21(ftp)

Hi, I am having small query and wheather it is possible ? that user can transfer the files using ftp client examples (filezilla) , but he can not use putty to login using ftp and run the commands, Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

2. UNIX for Dummies Questions & Answers

Can't login through putty

I am changing root password by passwd. Now I can directly log into the system but I can not log in using puttytel. It will show an error "Incorrect Password":rolleyes: (1 Reply)
Discussion started by: arrs
1 Replies

3. UNIX for Dummies Questions & Answers

Putty Login - with Batch?

Hello Everybody, I have a question on the UNIX server login with putty. Can this login procedure into PUTTY be automated with a macro or vbs or batch file? Kindly help me in directing me for the above. Thanks for the help, Regards, (3 Replies)
Discussion started by: swame_sp
3 Replies

4. Fedora

can't login via GUI but can via Putty

Hi all, I am able to login via putty to a fedora 10 workstation. But when i try to login via physical screen connected to workstation, it just gives me a blank screen and i cant see any options to enter username and passwd. How do i get the physical GUI to work. $ who -r ... (4 Replies)
Discussion started by: lramsb4u
4 Replies

5. UNIX for Advanced & Expert Users

Login putty automatically

Hi Guys , I am using putty.exe file to login to servers . I heard that there is way to save my username and password in putty so that i no need to give my creds while logging into putty . If so please provide me th way to do so . Please note : I am not talking about keyfile . Thanks in... (6 Replies)
Discussion started by: radha254
6 Replies

6. UNIX for Dummies Questions & Answers

Putty Auto Login

Hello All , Requiremnt : i want to login to putty automatically and change the settings like i want , for ex : changing the "lines of scrollback" , " under colors , want to check to checkmark the option use system colors" . Like this i want to do . I have a bash file created to login . But... (2 Replies)
Discussion started by: radha254
2 Replies

7. Ubuntu

Login from putty in wndows7 to connect ubuntu machine

hi, i have ubuntu installed on windows 7. I am trying to connecting to ubuntu from windows 7 using putty but it is giving network problem. I am trying to connect with ip address Thanks (9 Replies)
Discussion started by: diehard
9 Replies

8. Shell Programming and Scripting

Some automatic process to login in putty. install some patch

Hello, I was wondering, we have multiple servers where we login from Putty. Is there some way we get automatically loged in after giving server name and password(by saving it in some file or like that) Just a thought (2 Replies)
Discussion started by: mirwasim
2 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Is it possible to use PuTTY psftp.exe to move file from one directory to another?

Hello All, I am running a script (power shell) from my desktop (Windows). The script needs to sftp a file(using PuTTY psftp.exe ) from my desktop to a server(UNIX server). Then, as a second step, the script needs to move (or copy and delete) this file from one directory on the server (UNIX server)... (3 Replies)
Discussion started by: scampi
3 Replies

10. AIX

Able to ping the server but not able to login through putty it says network timeout

Able to ping the server but not able to login through putty it says network timeout Please assist (3 Replies)
Discussion started by: Vishal_dba
3 Replies
pscp(1) 							 PuTTY tool suite							   pscp(1)

NAME
pscp - command-line SCP (secure copy) / SFTP client SYNOPSIS
pscp [options] [user@]host:source target pscp [options] source [source...] [user@]host:target pscp [options] -ls [user@]host:filespec DESCRIPTION
pscp is a command-line client for the SSH-based SCP (secure copy) and SFTP (secure file transfer protocol) protocols. OPTIONS
The command-line options supported by pscp are: -V Show version information and exit. -pgpfp Display the fingerprints of the PuTTY PGP Master Keys and exit, to aid in verifying new files released by the PuTTY team. -ls Remote directory listing. -p Preserve file attributes. -q Quiet, don't show statistics. -r Copy directories recursively. -unsafe Allow server-side wildcards (DANGEROUS). -v Show verbose messages. -load session Load settings from saved session. -P port Connect to port port. -l user Set remote username to user. -batch Disable interactive prompts. -pw password Set remote password to password. CAUTION: this will likely make the password visible to other users of the local machine (via com- mands such as `w'). -1 Force use of SSH protocol version 1. -2 Force use of SSH protocol version 2. -C Enable SSH compression. -i path Private key file for authentication. -scp Force use of SCP protocol. -sftp Force use of SFTP protocol. MORE INFORMATION
For more information on pscp it's probably best to go and look at the manual on the PuTTY web page: http://www.chiark.greenend.org.uk/~sgtatham/putty/ BUGS
This man page isn't terribly complete. See the above web link for better documentation. PuTTY tool suite 2004-03-24 pscp(1)
All times are GMT -4. The time now is 09:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy