COZYHUB
  • Home
  • Disclaimer
  • Privacy Policy
  • About
  • Contact

Execute Test-NetConnection continuously until key pressed in PowerShell


I would like to execute below command continuously until a key is pressed. As an example:

Test-NetConnection -ComputerName google.com -Port 80

How can I do this?

1

Best Answer


You can use a do{...}until() with [console]::KeyAvailable

do{test-Connection -ComputerName google.com -Count 1Start-Sleep -Seconds 1}until([Console]::KeyAvailable)

Random Posts

ffmpeg concat: "Unsafe file name"Google Apps Script - IF ELSE with multiple conditions combined with AND and ORusing less-loader in webpackChar Comparison in CNumber format in excel: Showing % value without multiplying with 100nargin, vargin, exist, what is the best way to implement optional arguments matlabhow to plot a line chart in R?SABRE RedWeb Installation / Getting Startedany open-source/free .NET profanity filter for website?Reverting from multiindex to single index dataframe in pandasHow to get Aruco pose estimation in OpenCV Python?TS2531: Object is possibly 'null'logistic regression get the sm.Logit values (python, statsmodels)Changing the Fork() system callyum local install to install a package with its dependencyRaycast an object to enbable a mouse click event with Three.jsMATLAB "out of memory" errorspark: How does salting work in dealing with skewed dataWhat is a NumberFormatException and how can I fix it?How to display google map directions given latitude and longitude information in r
Designed by COZYHUB