Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command for opening serial port in Windows 7

Is there a Windows command for opening serial ports, say COM3 via the command prompt in Windows 7? For example:

OPEN "COM6" AS #1

I cannot use pyserial or any other utilities that are not distributed with Windows 7.

Preferred solution Opening a COM port in QBasic on Windows 7

like image 820
Olumide Avatar asked Oct 08 '12 16:10

Olumide


1 Answers

Maybe you can use the Powershell? It's included in Win7...

code taken from here http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.aspx

Writing to a Serial Port

PS> [System.IO.Ports.SerialPort]::getportnames()
COM3
PS> $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one
PS> $port.open()
PS> $port.WriteLine("Hello world")
PS> $port.Close()

Reading from a Serial Port

PS> $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one
PS> $port.Open()
PS> $port.ReadLine()
like image 80
Max Avatar answered Oct 31 '22 00:10

Max