Here is a formula for preventing ants that I found on a forum (maybe this one) several years ago. I can’t say for certain if it works but I can say I use it and have never had an ant issue. It is non-toxic and actually has a pleasant fragrance which might be why ants don’t like it. I apply it to the power cord at the point where it leaves the ground with a standard trigger 32 ounce spray bottle.
• 1 bottle pure mint extract from the spice section
• ¼ cup rubbing alcohol
• Couple squirts dish soap for adherence
• Fill with water
• Safe inside and outside