Normally, pm2 have a default startup feature that very easy to use but that one is working only with Linux and Mac OS versions. So, if you are trying to use pm2 startup in Windows environment, you need to install the pm2-windows-startup utility to make it automatically.
npm install pm2-windows-startup -g
And now, PM2 will now automatically refresh the saved processes on startup. To save the current processes need to execute the below command in common prompt.