Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell do while loop that runs unitl I do a CTRL C

$
0
0
All,

I am confused on how to exactly run a while true loop.  Essentially I would like to run this command repeatedly (every second) until I cancel it out.

EX. - > get-WmiObject -class Win32_printer | select name" 

Something like this below

while true ; do (get-WmiObject -class Win32_printer | select name) |start-sleep 5;done  **** I know syntax and layout of this is wrong....I am thoroughly confused.

Thanks for the help.
Rob.

Thank you for your help and time, Robert Jaudon


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>