Ffmpeg error: 2nd pass has more frames than 1st pass
Two-pass is meant for when you have a fixed input and you wish to analyze the file beforehand, so that the encode is optimized for the target bitrate and other encoder parameters.

Your 1st command is discarding the capture. And so your 2nd command is using the stats from pass 1 to apply to a new capture, which obviously won't match.

Use

ffmpeg -y -rtbufsize 1500M -f gdigrab -framerate 30000/1001 -draw_mouse 0 -offset_x 224 -offset_y 232 -video_size 1280x720 -i desktop -c:v libx264 -r 30000/1001 -an -tune zerolatency -preset ultrafast -crf 0 Capture.mp4


and then

ffmpeg -y -i Capture.mp4 -pix_fmt yuv420p -c:v libx264 -pass 1 -an -b:v 2600k -f mp4 NUL

ffmpeg -y -i Capture.mp4 -pix_fmt yuv420p -c:v libx264 -pass 2 -an -b:v 2600k myVideo.mp4