Error When Compiling a Simple C Program File in Windows 10 CMD Prompt Using MinGW (gcc: error: No such file or directory)

You should not be working under a system folder C:\Windows\System32. Probably there are access restrictions (e.g. from antivirus) that cause you to run into problems.

I also recommend you don't do it in a path containing spaces or special characters.

Try under a folder C:\Temp for example.

If you want to try with a more recent MinGW-w64 you can get it from https://winlibs.com/. That site also gives an example on how to use it from the Command Prompt.

If you're new to all this you may also want to consider an IDE like Code::Blocks or Visual Studio Code.