D
D
daserge2015-09-24 11:42:59
Automation
daserge, 2015-09-24 11:42:59

How to send a shutdown command to netcat?

Based on yesterday's article on Habré We fasten multimedia keys in Yandex.Radio automated the process using netcat for windows .
In principle, everything worked, but the window cmddoes not close automatically, tell me how this can be solved?
start-pause.bat

type start-pause.txt | cmd /c "D:\Soft\netcat-win32-1.12\nc.exe" -v localhost 32000

start-pause.txt
(function(f){f.player.pause() || f.player.resume() || f.play()})(Mu.pages.player.flow);

The following options did not help:
taskkill /im nc.exe /f
start "" "D:\Soft\netcat-win32-1.12\nc.exe" ...
In the case of start, it is not entirely clear how to properly redirect the buffer.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
irvinzz, 2015-09-25
@daserge

Although with crutches, but managed to adapt.
see end of article

E
Eugene, 2015-09-25
@yellowmew

Like an experiment. Can this powershell script do what you want without using netcat?
sendtcpdata.ps1 text

$Message = '(function(f){f.player.pause() || f.player.resume() || f.play()})(Mu.pages.player.flow);'
$socket = new-object System.Net.Sockets.TcpClient("localhost", 32000)
$data = [System.Text.Encoding]::ASCII.GetBytes($message)
$stream = $socket.GetStream()
$stream.Write($data, 0, $data.Length)

command to run :
powershell.exe -WindowStyle hidden -File c:\scripts\sendtcpdata.ps1 -ExecutionPolicy unrestricted

D
daserge, 2015-09-24
@daserge

So the correct option is (thanks again, @yellowmew):
Upd: Someone not read-only, pliz give a link here, people can't .
Upd2: The version in the article with vbs works without the appearance of a window, unlike cmd.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question