Format for the importprivkey command is:
importprivkey "privkey" ( "label" rescan )
Arguments:
1. privkey (string, required) The private key (see dumpprivkey)
2. label (string, optional, default=current label if address exists, otherwise "") An optional label
3. rescan (boolean, optional, default=true) Rescan the wallet for transactions
So, you'd use something like:
importprivkey "5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF" "" false
Should be relatively simple to code a script which would just read a file that contains a list of private keys and execute the bitcoin-cli command for you... and then on the last one, trigger a rescan by using:
importprivkey "WIF_PRIVATE_KEY_GOES_HERE" "" true