Yeah the infamous "programmer's gaze". Batch files are boring. That's one reason.
You need to see progress and be continually learning to stay interested.
It's natural to zone out at the start of something new and daunting until you get "in the zone" and get some momentum, then again at the end when it's just tedius fixing and up keep and nothing new left to explore and the app changes very little from week to week. When you get into a spot where you're stuck, same thing. I find it helps to forget about that part and focus on something else for a while. The more you stare are something that's not clicking, the longer it's going to take you to trudge through it. Then you come back later and solve it in 5 minutes.
I get that way when messing around on home brew on game consoles. I'll get excited to explore a new platform (GBA ARM7 for example). Once I've done some advanced HDMA tables, troubleshooted really tough undocumented timing issues that prevented me from running on real hardware via flash cart, and feel that I have throughly mastered all the hardware offers and have throughly abused and experimented with every opcode in the CPU instruction set... I sort of zone out and don't care any more and the 10,000th line of ARM/C is just a tired blur.