When the engine is running and if the check engine light is on it has nothing to do with the battery or alternator. The bat light may come on when the key is in the run position but the engine is not running, that is normal. You need to get the codes read from a dealer or auto zone will do it...