I used malwarebytes and ms defender and it came up with nothing. This first starting happening around July 20When did this first show up? This is usually caused by malware/ virus, something you apparently found out. What anti-malware program did you use? You should also run an antivirus like MS Defender. You should also try a clean boot, https://support.microsoft.com/en-us/help/929135/how-to-perform-a-clean-boot-in-windows and see if this occurs in safemode.
THE problem is the CMD window pops up at random times so it will be hard to see which program it isIt's very possible a program is being prevented from installing is running in the back ground. First I would check the Programs and Features and see if any program was installed during that time frame; if so uninstall it. If that doesn't work, I would check the task manager processes and start removing non-Windows programs until the command windows stop popping up.. If that doesn't work, try a clean boot https://support.microsoft.com/en-us/help/929135/how-to-perform-a-clean-boot-in-windows and see if it solve your issue.