Function ABC {
[Object] $Connection = ((New-Object -TypeName System.IO.Ports.SerialPort -ArgumentList COM1, 11200, None, 8, one)
$Connection.open()
}
Maintenant, je veux utiliser $Connection
à l'extérieur quand j'en ai besoin. Comment puis-je accéder commePort série Powershell Portée variable
$Connection.write("`r") # Calling from outside
$Connection.Readexisting("`r") # Calling from outside
merci beaucoup, à la fois la réponse fonctionne pour moi. mais son long chemin à parcourir maintenant. – Vimal2311