AND Gate with 2 NPN Transistors
You can do something like this, where the signal generators are your batteries.

However, that's a lot of components to test for both batteries present, and you loose voltage off the top through those diodes and mosfets.

You need to consider the rationality of what you are really trying to do here. Does it really matter if only one battery is installed? Will it just mean whatever you are powering will only run for half the time?

If it is critical that both batteries be installed, you may also want to consider a more mechanical solution that puts micro-switches under the batteries.







simulate this circuit &ndash; Schematic created using CircuitLab