20 lines
353 B
Python
20 lines
353 B
Python
import win32pipe
|
|
import win32file
|
|
|
|
# 连接到命名管道
|
|
pipe_name = r'\\.\pipe\botext'
|
|
pipe = win32file.CreateFile(
|
|
pipe_name,
|
|
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
|
|
0,
|
|
None,
|
|
win32file.OPEN_EXISTING,
|
|
0,
|
|
None
|
|
)
|
|
|
|
win32file.WriteFile(pipe, b'close1')
|
|
|
|
# 关闭管道
|
|
win32file.CloseHandle(pipe)
|