How to run a command in PowerShell on startup?


I’m new here. I just want to know how could I run a command in PowerShell automatically every time I turn on my PC. The command is this one:

“$i=99999900; while (1) { $j=[System.Math]::Sqrt($i); write-host $i,:,$j; $i=($i+1)%99999999; }”

It is just a counter to keep my CPU busy for preventig BSODs due to a faulty processor. Anyone knows how can I achieve this?

Thanks in advance!

Welcome to the forum.

That’s actually not a PowerShell topic. :wink: You can use the task scheduler to run a task at startup.

To learn how to run PowerShell with the according command line arguments you can read the help by calling

PowerShell /?

Replace the processor :slight_smile: