Search code examples
csystemdos

Color command not working using system() function in c


System command is used to execute the dos shell commands using the c program asif they were executed directly on command prompt itself.

color command working on the dos shell when applied directly but fails when used by the system() function.


Solution

  • Since COLOR is an internal command and not a program, the system() function (normally) cannot recognize it.

    However, you can try by using the CMD program, with parameter /K, in this way:

        system("CMD.EXE /K COLOR 63 ");