Change command prompt properties in c

Asked

Viewed 940 times

2

I am new to the language c. I wonder if it is possible to change command prompt properties by c, such as cmd size, width or even font?

  • Can you be more specific? Want to change via programming, you have cmd source code?

  • would like to change it via programming type increase the layout or change the source something like

2 answers

1

From what I understand, you will have to change these properties in the Windows registry. For each property there is a DWORD value. Be very careful when changing these values, some invalid data may end up corrupting and compromising the operating system. Before changing you will have to make a data conversion to hexadecimal. The registry key responsible for these properties is the: HKEY_CURRENT_USER Console.

If you still have no idea how to do this in C language, follow a link from a tutorial that can help you:

Add/Delete and Read Windows Registry in C#, simple and direct.

0

You can use color codes:

#include <stdio.h>

#define RED   "\x1B[31m"
#define GRN   "\x1B[32m"
#define YEL   "\x1B[33m"
#define BLU   "\x1B[34m"
#define MAG   "\x1B[35m"
#define CYN   "\x1B[36m"
#define WHT   "\x1B[37m"
#define RESET "\x1B[0m"

int main()
{
  printf(RED "vermelho\n" RESET);
  printf(GRN "verde\n" RESET);
  printf(YEL "amarelo\n" RESET);
  printf(BLU "azul\n" RESET);
  printf(MAG "magenta\n" RESET);
  printf(CYN "ciano\n" RESET);
  printf(WHT "branco\n" RESET);

  return 0;
}
  • I think what he’s looking for is a way to change the properties of the window, not just the source

  • Before Windows 10, I think, the Windows command prompt does not accept ISO 6429 escape sequences ("ANSI")...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.