The command Carlos gave should work if you paste it directly on the command line. If you want to use it in a batch file, double up on the percent sign before the 4
Command line:set /a %RANDOM% % 4 + 1
Batch file:@echo off
set /a rnd=%RANDOM% %% 4 + 1
echo %rnd%