Jump to content

Plink.exe and StdoutRead


Recommended Posts

I found this topic:

but it doesn't seem to solve my problem.

I'm trying to create a script to help my guys provision new Cisco switches for deployment. I was hoping to find a nice, easy way to send data over a serial connection (similar to TCPSend), but alas.

I read a lot about mscomm32.ocx and netcomm.ocx, but there seem to be licensing issues. Plink seems to be a good bet, but my attempts at reading the output are not working. If I run plink manually, (to an unconfigured switch) I get a Switch>_ prompt. But when I run the same command here, my stdoutread loop never ends. Any way around this?

#include 

$plink = Run(@ComSpec & " /c plink.exe -v -load serial","",@SW_HIDE,$STDIN_CHILD + $STDERR_MERGED)

StdinWrite($plink,@CR)
StdinWrite($plink)

Local $data
While True
$data &= StdoutRead($plink)
If @error Then ExitLoop
WEnd

MsgBox(0,"",$data)
Link to comment
Share on other sites

  • 9 years later...

Hello

Try this for Show the interface:

local $plinkhandle = Run("C:\TEMP\plink.exe -serial COM1 -sercfg 115200, 8, 1, N, N", "")

 

where you need put directory where are plink, you need use one module TTL232 put on Port USB.

install driver interface TTL232 on you PC, Rename the Port number and speed (115200) that you can use

local $plinkhandle = Run("plink.exe -serial COM1 -sercfg 115200, 8, 1, N, N", "")

local $plinkhandle = Run("plink.exe -serial COM2 -sercfg 115200, 8, 1, N, N", "")

local $plinkhandle = Run("plink.exe -serial COM3 -sercfg 115200, 8, 1, N, N", "")

the command open one windows similar to MSDOS

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...