0

I just want to send Commands(Eg.00LI002LE99) to an local IP, 192.168.1.186 9760, I am trying to send that command using Batch programming,

I have tried :

1.

@echo off
cd..
cd C:\nc
nc 192.168.1.180 9760
00LI002LE99
end

2.

 echo 00LI002LE99| nc 192.168.1.186 9760

I can open the socket, but i cant send that command. Please help me on this.

2
  • 1
    Why use ancient "batch" technology? PowerShell can directly call upon any .NET Framework classes, just in case it doesn't already have a built-in way to do these things. Commented Dec 5, 2013 at 6:30
  • possible duplicate of How to establish socket connection using the command line Commented Mar 18, 2014 at 7:37

2 Answers 2

1

Try this: add an exit command at end, and rename the file to .txt extension:

testfile.txt:

@echo off
cd..
cd C:\nc
nc 192.168.1.180 9760
00LI002LE99
end
exit

Then, "execute" it this way:

cmd < testfile.txt
Sign up to request clarification or add additional context in comments.

2 Comments

not working!! and Aacini how to disconnect the socket using command?
If not working, then nc program doesn't admit input redirection, and there is no way to solve that :-(
1
echo 00LI002LE99| nc 192.168.1.180 9760

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.