473,382 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

write the escape character to the console?

How do you send an escape key to the console? I was trying to change
the color of the text in cmd.exe with something like this:

Console.Out.Write("\u001b[1;31m");

But that doesn't seem to have any effect. I also tried 001b. Any ideas?

Nov 1 '07 #1
1 2377
not_a_commie wrote:
How do you send an escape key to the console? I was trying to change
the color of the text in cmd.exe with something like this:

Console.Out.Write("\u001b[1;31m");

But that doesn't seem to have any effect. I also tried 001b. Any ideas?
You need ANSI.SYS loaded to use ANSI escape sequences.

..NET 2.0 introduced the two properties:

Console.BackgroundColor
Console.ForegroundColor

Use them instead.

Arne

Nov 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
8
by: collinm | last post by:
hi we use linux and c language under bash i do echo -e \\000\\000\\000\\000\000\\001Z00\\002AA LINUX \\004 >/dev/ttyS2 that send command to a led display (alpha sign communication)
4
by: Guadala Harry | last post by:
I need to place the following into a string... How can I properly escape the % " / < and > characters? <table width="100%" border="0" cellspacing="0" cellpadding="4px" class="hfAll"></Table> ...
3
by: newsgroupie | last post by:
Hi Newsgroupies, Please could someone tell me the escape character for " (double quote) in a string.Format(...) method as \x22 doesn't work as it comes out as \" in the result. i.e....
2
by: Tiësto | last post by:
Sometimes I have a string variable with many escaped characters. And when I write ?MyString in the Immediate window, the output is done with the \n \t and similar characteres. Is there any...
15
by: pkaeowic | last post by:
I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN....
5
by: bh | last post by:
I'm trying to convert the following statement to VB.NET: writer.Write(@"<some html here>"); I tried simply removing the semicolon, but VB chokes on the @-sign. Unfortunately, when searching...
13
by: Angus | last post by:
Hello I have a load of bytes like this: unsigned char mybyte = {0xa1, 0x14, 0x02, 0x01, 0x01, 0x02, 0x01, 0x0a, 0x30, 0x0c, 0x80, 0x03, 0x32, 0x30, 0x31, 0x62, 0x05, 0x80, 0x03, 0x32, 0x30,...
2
by: | last post by:
I mainly work on OS X, but thought I'd experiment with some Python code on XP. The problem is I can't seem to get these things to work at all. First of all, I'd like to use Greek letters in the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.