LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 02-02-2011, 05:37 AM   #1
nirmal.mukundan
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
Batch file to login to putty


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
 
Old 02-02-2011, 11:35 PM   #2
nirmal.mukundan
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Original Poster
Rep: Reputation: 0
Please help

Hi everyone...

I have been trying all possible ways. Can some one please help me with this.

Regards
Nirmal
 
Old 02-07-2011, 04:52 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
This isn't a networking question and is a windows question. Moving to Genetal were it may get more responses.
 
Old 02-08-2011, 02:52 PM   #4
Latios
Member
 
Registered: Dec 2010
Distribution: Arch
Posts: 115

Rep: Reputation: 21
A hack i used recently in similar occasion :

Add a new user specifically for running this script

Login to the system thru ftp

Upload a ~/.bashrc which includes the wanted commands, it executes once and then replaces itself with the normal bashrc

Log out of ftp

Log in to ssh and quit - the script had executed
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to login to server thru console but able to login via network using putty maxy7710 Linux - Newbie 4 01-12-2010 10:27 AM
how can i enter unix commands in a putty session--> thru batch programming skipper_penguin Linux - General 2 06-19-2009 02:40 PM
putty ssh batch zerocool22 Linux - Networking 8 06-19-2009 09:47 AM
batch file for accessing a shared file in ubuntu samba pdelcast Linux - Networking 5 04-24-2008 12:21 AM
Putty Login Delay joadoor Linux - Networking 5 12-09-2005 12:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration