Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

PowerTip: Use PowerShell to Start a Bunch of Processes

$
0
0

Summary: Learn how to start a bunch of processes by using Windows PowerShell.           

Hey, Scripting Guy! Question How can I use Windows PowerShell to start a whole bunch of processes for testing purposes on one of my systems?

Hey, Scripting Guy! Answer Use a Windows PowerShell range operator, such as 1..10, to specify how many processes you want to create.
           Then pipe the results to the Foreach-Object cmdlet, and in the script block, use Start-Process to create
           the commands you need. Here is an example:

1..10 | Foreach {Start-Process notepad}

You can simplify this command by using % for Foreach, and by simply calling the executable:

1..10 | % { notepad}

To check how many processes you created, use the Get-Process cmdlet:

(Get-Process notepad).count


Viewing all articles
Browse latest Browse all 34890

Trending Articles



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