Advertisement
compu_85

Untitled

Jun 24th, 2014
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #set the COM port number here
  2. $portno = 4
  3. $test_word="Test"
  4. $result1 = "NoRun"
  5. $result2 = "NoRun"
  6. $invalid = "Invalid"
  7. $count = 1
  8.  
  9. #Write-Host $command_string
  10. $port= new-Object System.IO.Ports.SerialPort COM$portno,9600,None,8,one
  11.  
  12. ForEach ($word in Get-Content "C:\Users\jperkins\Downloads\4-numeric.txt")
  13. {
  14. $command_string="$word`n"
  15. $port.open()
  16. $port.WriteLine("$command_string")
  17. $result1 = $port.ReadLine()
  18. $result2 = $port.ReadLine()
  19. $port.Close()
  20.  
  21. Write-Host -NoNewLine $count`t
  22. Write-Host -NoNewLine $word`t
  23. #Write-Host $result1
  24. Write-Host $result2
  25.     If ($result2 -NotMatch "invalid system")
  26.     {
  27.     Write-Host $word
  28.     Write-Host $result2
  29.     $word>>"C:\Users\jperkins\Dropbox\pw_result.txt"
  30.     Break
  31.     }
  32.  
  33. $count++
  34. Start-Sleep -Milliseconds 25
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement