I found this solution:
To execute cmd commands without opening a window I create a bat file (the program does this) then I use this code:
ShellExecute(NULL, "open", "Directory_Of_Bat_File", NULL, NULL, 0);
This opens the bat file and executes the commands. I also noticed that you don't need system() to delete the bat file but you can delete it by writing:
del Directory_Of_Bat_File
Inside the bat file and this will delete it when you execute the bat file (it will delete itself). This without opening a new window.