saveRunningVMs.bat for Windows: script that automatically save the state of all running VMs without naming them explicitly.
set VBoxManageEXE="%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe"
set ListRunningVMS=%VboxManageEXE% list runningvms
for /f tokens^=2^,4^ delims^=^" %%p in ('%ListRunningVMS%') do %VBoxManageEXE% controlvm %%p savestate
echo all vms saved, you can shutdown now.
rem shutdown /s /t 10