You have quite a few options here to reach your goal, depending on what you are willing to risk. Not all of them having to do with caching your sudo credentials.
You can switch off needing a password for your user or for your user executing
shutdown by adding a line with the tag
NOPASSWD to your sudoers file.
You can authenticate to sudo by running
sudo -v. Your password will be cached for 15 minutes so you would have to run a
sudo -v all, say, 12 minutes, to update your credentials and kill that task after the last batched process is done.
If you know how long your batched processes take, you can simply tell
shutdown the time after which it shall shut down the system.
You can increase the default 15 minute timeout of the password cache with the option
timestamp_timeout in the sudoers file. Either arbitrarily, or, if you know how long the batches processes take, to that time. Or you could switch off the timeout completely with a negative value and use
sudo -v to authenticate and
sudo -k to "log out" of sudo when you are done. In between these two calls, you can run
sudo without entering your password again.
If you are not fine with not requiring a password for sudo, but instead store your password in a text file, readable only by your user, then you can create a little batch script which outputs your password to stdout and either use this as the askpass program for sudo or simply use it in a pipe with
sudo -S, which read the password from
stdin. Combined with a little script you could store your password in a text file at the beginning, from which it is read by the script providing it to
sudo and at the end delete this file again.
./echopw | sudo -S or
sudo -A shutdown -h now
Or, at last, you could simply put the shutdown command in a shell script and set the shell script to suid, owner root, your group, 750.