Very, very carefully.
Although that's rather tongue in cheek, it's true: slowly and carefully is the key approach.
The quicker you try to move, the rougher the shape you produce.
You also significantly increase the chance of breakage.
Make an initial rough hole at the center point of your eventual window area, and then cut out to finish the edges.
A serrated knife used with a slow, steady sawing motion should work.
Luckily, if you do end up with lopsided, misshapen, or unexpected results, icing and candy decoration can help hide the mistakes :)
cooking.stackexchange.com/users/17272/Erica
Serrated knife is the best choice and was what I was taught to use in my baking class.
What @Erica said is right, slow and steady.
If the pre-bake is too tough and dry then a possible fix is to add steam to the area you are cutting the window to both sides to soften before cutting (assuming you didn't attach the piece to something already).
You can boil some water and then set the piece above it to soften or even fill a bowl with water then put the cookie above the bowl in the microwave (microwave
may over cook cookie!!!!)
(don't let the water touch the cookie)
Try not to use anything other than a serrated knife if possible.
But if you are trying for a small window then you may have to create room for the serrated knife with a pairing knife before hand just try not to use it too much if at all.
Pairing knifes often will put lots of pressure on and make it easy to crack the brittle cookie.
If it does crack, fill it with thick-ish consistency royal icing (watch out if you steam it after adding royal icing it may and probably will fall apart) and let it set before trying to deal with it more (unless you wanna try to cut out the window first then glue it together with icing).
cooking.stackexchange.com/users/66642/Jade So
If money (and complexity) is no object, laser cutting creates the best finish.
A friend of mine created a fantastic gingerbread 'mansion', all of the pieces for which were cut from large slabs of gingerbread she baked.
The difficulty in your case would be calibrating the laser to cut in the right place on your pieces.
This is obviously not a practical solution for most people, but should nevertheless be mentioned
cooking.stackexchange.com/users/50888/canardgras
I'd propose the carving approach: With just the very tip of a pointy knife, draw the lines where the window should be Carve a thin layer of gingerbread away from the inside of the window to the line you made.
Re-cut the outline of the window to get a sharp and straight edge Repeat carving out the inside of the window to the edge
The reason for this approach is that sticking a knife through the gingerbread to cut out any shape first adds material to the gingerbread that is not flexible enough to accomodate the knife without breaking.
By pre-cutting shallow lines and then carving the inside out you only remove material, lowering the chances of breaking your gingerbread.
cooking.stackexchange.com/users/71396/Elmy
I would start not with a knife, but with a cookie cutter.
If you dont't have a square cookie cutter, choose something which has at least one straight side, but is smaller than the full window, maybe some kind of triangle.
Cut that out, then use the tip of a knife to cut out the other straight sides.
cooking.stackexchange.com/users/4638/rumtscho
We have a gingerbread kit that we would like to add windows.  What is the best way to cut into the hard gingerbread without breaking?
Cutting windows into a premade gingerbread
cooking.stackexchange.com
<cutting><gingerbread>
cooking.stackexchange.com/questions/94823
cooking.stackexchange.com/users/71337/user71337
Laser cutting would give the best result , but otherwise it is best to cut with a serrated knife, possibly starting with a hole cut with a paring knife. Alternatively, you can cut a hole in the middle, score around the edges with a paring knife and cut lines from the centre to the edges with a serrated knife. The technique for cutting windows in a gingerbread house is to make a whole in the centre of the window and cut towards the outside. A small, pointed knife is required to make the hole and a serrated knife for the cutting. Steaming the area where you want to cut may make the job easier. Invest in a laser cutter but that is probably expensive.
Make asmall hole with a pointy knife then cut from the centre to where you want the edges to be. Use a serrated knife for the main cutting. Use steam to soften the gingerbread in the are you want to cut. Get a laser cutter.