Jump to content

Running commands on remote box using Plink


Recommended Posts

Hi,

I am using Plink to access remote server. I want to run few commands on the remote server. Though I am able to connect to the remote machine, I am not able to run any command.

The following works:

---------------------------------------------------

plink -ssh -l %user_name% -pw %user_pwd% %machine%

---------------------------------------------------

The following doesn't:

-------------------------------------------------------------------

plink -ssh -l %user_name% -pw %user_pwd% %machine% "cd e:\data"

-------------------------------------------------------------------

Can anyone please tell me how to do 'cd' on a remote box using plink? Obviously, I want to run few other commands as well after doing 'cd' operation.

Regards,

GC

Link to comment
Share on other sites

  • 1 month later...

Hi,

I have finally been able to run command on remote machine using Plink. The problem was with the syntax. It now works both by passing the command as argument, and by using the ‘–m file’ option provided with Plink.

For example,

plink -ssh -pw xxx gaurav.chhabra@server cd c://sample//gc//

plink -ssh -pw xxx gaurav.chhabra@server –m file.txt

where ‘file.txt’ contains:

cd c://sample//gc//

I am able to run executables and commands such as cd, mkdir. The only issue that I am now having is that, I am not able to run commands such as move, rename etc.

For example,

---------------------------------------------------------------------------------------------

plink -ssh -pw xxx gaurav.chhabra@server move c://sample//gc//file.txt c://test//

move: not found

---------------------------------------------------------------------------------------------

Any idea what the problem might be?

Thanks,

GC

Link to comment
Share on other sites

  • 3 weeks later...
move: not found - Any idea what the problem might be?

Almost certain that it is a syntax error. You would have to give a lot more details for anyone to to give the time and space to go deep into your problem, as most of the people on the forum are just normal family people having to get tea ready, walk the dog, beat the kids, and then get up ready to go to work the next morning. :( Take your luck, and just hope that someone is interested enough to answer your problem, and polish your ego.

How helpful did you find my replies to your recent post ? - http://forums.windowsforum.org/index.php?showtopic=45698

John.

Link to comment
Share on other sites

Hi John,

First of all, my sincere apologies for the delay in reply!

As far as posting more information is concerned, I want to mention that I am not lazy. :) It's just that I couldn't think of anything else to mention in my post.

By the way, I usually set 'Instant Notification on Replies' on every forums that I visit; looks like I missed setting it on this forum.

Anyways, thanks for your time. I have finally got a solution to my issue.

plink -ssh -pw xxx gaurav.chhabra@server cmd.exe /c move c://sample//gc//file.txt c://test//

Thanks & Sorry again,

GC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

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. Privacy Policy