Link to home
Start Free TrialLog in
Avatar of reddy2388
reddy2388

asked on

Plink.exe not executing secound cmd

C:\Reset>Plink.exe -load "SAN" -ssh -P 22  x@SAN -pw s5 -v -m 1.txt

the Below is the output
Started a shell/command
SAN ---------------- DISplaying the hostname
Server sent command exit status 0
Disconnected: All channels closed

1.txt containg 2 cmds one is Hostname and Dir  

its only outputs  Hostname and DIr cmds does not execute
Avatar of parparov
parparov
Flag of United States of America image

Could you try '-batch' switch to plink?
Avatar of reddy2388
reddy2388

ASKER

Still no Luck its not executing secound cmd
Avatar of serialband
Have you tried switching the order of the commands to see if the Dir command works?
I tried that Still no luck
No luck with the dir command or no luck with the 2nd command when you swapped?
no luck with both

C:\Reset>Plink.exe -load "SAN" -ssh -P 22  x@SAN -pw s5 -v -m 1.txt

I noticed now, that your command has a both a -load "SAN" and a x@SAN.  I've just tried this myself and plink complains to me that x@SAN is not a command not found.  I suspect this extra bit is throwing off your textfile commands.  

When you create your session named SAN, you likely entered only the server name. You can add the username in the field.  So, instead of just your server name of SAN, you should have x@SAN in the field when you save your session.  (e.g.  my_user_name@server_name.google.com)


If you can, the other thing you should add to your server is an ssh key, so you never have to type your password in clear text anywhere on the command line or in a script file.  Use pageant to load your keyfile, enter your passphrase, and all subsequent calls to your remote ssh server won't need passwords, assuming they support ssh keys.  I never type my password in the clear in any script if I can avoid it.
ASKER CERTIFIED SOLUTION
Avatar of reddy2388
reddy2388

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it works as expected