What you have to do is basically use the %time% variable and specify to count a certain number of characters into the string to extract the part you want. Typing "echo %time%" in a cmd prompt returns something like this:
11:11:38.36
To get just the hour out of this string, type "echo %time:~-11,2%" to display just the first 2 characters. You are basically telling it to display the %time% variable - "echo %time...", count 11 characters backwards from the end of the string - "...:~11..." and grab 2 characters from that point - "...,2%"
To grab the minutes the command would be "echo %time:~8,2%"
To set the variable "hour" to the current hour you would type this:
set hour=%time:~-11,2%
You can also string parts together to create a custom format in whatever combo you need also. For example, to add dashes instead of a colon between the HH:MM:SS you would type this:
"echo %time:~-11,2%-%time:~-8,2%-%time:~-5,2%"
and get: HH-MM-SS
Hope this helps. We use the %date% variable and parts of it all the time to automatically create files in whatever string combo we need the filename to be in.