Foodborne bacteria threaten human's health. Capillary electrophoresis (CE) is a powerful separation means for the determination of bacteria. Direct separation of bacteria suffers from the shortages of low resolution, channel adsorption, and bacterial aggregation. In this work, a method of nucleic acid strand displacement was developed to indirect separate the bacteria by CE. DNA complexes, consisting of probes and aptamers, were mixed with the three bacteria Staphylococcus aureus, Escherichia coli, and Pseudomonas aeruginosa. The aptamers could specifically bond with bacteria and release the probes. Through the separation of the probes, the bacteria could be indirectly determined by CE. This method avoided the shortages of direct separation of bacteria. Under the optimized conditions, the three probes for the bacteria could be separated and detected within 2.5min by high-speed CE with laser-induced fluorescence detection. The limits of detection for the bacteria were in the range 4.20×106 to 1.75×107 CFU/mL. Finally, the developed method was applied on the study of antagonism of the coexistent bacteria to reveal the relationship between them. Furthermore, the efficiency of bacteriostasis of three traditional Chinese medicines, Coptis chinensis, Schisandra chinensis, and honeysuckle, was also studied by this method.