batch file sending command to linux computer not working

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

batch file sending command to linux computer not working

#1 Post by aristosv » 05 Sep 2015 09:39

I am running the following batch file, to make a modification in a file on a linux computer.

Code: Select all

plink.exe -ssh root@192.168.0.30 -pw password_here /bin/sed -i -e '/export s_sshhost="hostname1_here"/a export s_vpnhost="hostname2_here"' /file/to/edit/here


I get this message

Code: Select all

& was unexpected at this time


If I run this command directly on the Linux computer it works, so I know its not a problem with the command

Code: Select all

/bin/sed -i -e '/export s_sshhost="hostname1_here"/a export s_vpnhost="hostname2_here"' /file/to/edit/here


whats wrong with my batch file?

Thanks

Aristos


aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

Re: batch file sending command to linux computer not working

#3 Post by aristosv » 05 Sep 2015 09:56

whats your point?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: batch file sending command to linux computer not working

#4 Post by Squashman » 05 Sep 2015 10:05

aristosv wrote:whats your point?

The point is we want to be informed of all the help you are receiving for this problem so we do not duplicate solutions or waste our time helping when it has already been solved on a different forum.

aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

Re: batch file sending command to linux computer not working

#5 Post by aristosv » 05 Sep 2015 11:01

can you assist with the problem at hand?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: batch file sending command to linux computer not working

#6 Post by Squashman » 05 Sep 2015 12:25

aristosv wrote:can you assist with the problem at hand?

Hard to when you are obfuscating the real command parameters you are executing. Batch files can choke for a lot of different reasons.

aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

Re: batch file sending command to linux computer not working

#7 Post by aristosv » 05 Sep 2015 23:02

Are you saying that I should provide the actual host names and the actual password?
In case there's something wrong with the host names or password, do you have a suggestion?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: batch file sending command to linux computer not working

#8 Post by ShadowThief » 05 Sep 2015 23:24

To test if it's something with the hostname or password, just try

Code: Select all

plink.exe -ssh root@192.168.0.30 -pw password_here

by itself.

Post Reply