Step 1: You open cmd (run as administrator), then you type
dism /online /get-targeteditions
Step 2: You copy and paste this code in cmd
If you want to upgrade to Windows Server 2012 R2 Standard you type:
dism /online /set-edition:serverstandard /productkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /accepteula
if you see “upgrade failed”, you restart your Windows Server 2012 R2. It will upgrade Windows Server 2012 R2 Evaluation to Standard.