I am trying to figure out how to run this loop asynchronously.
Get-ChildItem -Filter *.sql | Foreach-Object {
$database = $_.Name
mysql -u root -e "
DROP DATABASE IF EXISTS $database;
CREATE DATABASE $database;
USE $database;
SOURCE $database;
"
}
I removed a bunch of unrelated stuff form the code but that's the gist of it.
As I see it from the task manager, this program only uses one of the 12 threads my Ryzen 5 1600 has. I would like to speed things up by running them in parallel.