Windows character mode applications using the functions provided by the console I/O functions. This tag should be used by questions about the console functions, structures and winevents, which support character mode applications.
Questions tagged [windows-console]
614 questions
361
votes
12 answers
Assign output of a program to a variable using a MS batch file
I need to assign the output of a program to a variable using a MS batch file.
So in GNU Bash shell I would use VAR=$(application arg0 arg1). I need a similar behavior in Windows using a batch file.
Something like set VAR=application arg0…

initialZero
- 6,197
- 9
- 29
- 38
355
votes
19 answers
How can I use Unicode characters on the Windows command line?
We have a project in Team Foundation Server (TFS) that has a non-English character (š) in it. When trying to script a few build-related things, we've stumbled upon a problem; we can't pass the š letter to the command-line tools. The command prompt…

Vilx-
- 104,512
- 87
- 279
- 422
311
votes
14 answers
Logical operators ("and", "or") in DOS batch
How would you implement logical operators in DOS Batch files?

JoelFan
- 37,465
- 35
- 132
- 205
83
votes
17 answers
Output Unicode strings in Windows console
Hi I was trying to output unicode string to a console with iostreams and failed.
I found this: Using unicode font in c++ console app and this snippet works.
SetConsoleOutputCP(CP_UTF8);
wchar_t s[] = L"èéøÞǽлљΣæča";
int bufferSize =…

Andrew
- 2,309
- 4
- 27
- 42
81
votes
7 answers
Displaying Unicode in PowerShell
What I'm trying to achieve should be rather straightforward although PowerShell is trying to make it hard.
I want to display the full path of files, some with Arabic, Chinese, Japanese and Russian characters in their names.
I always get some…

Dhiwakar Ravikumar
- 1,983
- 2
- 21
- 36
48
votes
4 answers
Colored text output in PowerShell console using ANSI / VT100 codes
I wrote a program which prints a string, which contains ANSI escape sequences to make the text colored. But it doesn't work as expected in the default Windows 10 console, as you can see in the screenshot.
The program output appears with the escape…
user2226112
40
votes
4 answers
Console App Terminating Before async Call Completion
I'm currently writing a C# console app that generates a number of URLs that point to different images on a web site and then downloads as byte streams using WebClient.DownloadDataAsync().
My issue is that once the first asynchronous call is made,…

Andrew Keller
- 3,198
- 5
- 36
- 51
33
votes
6 answers
Preventing MSYS 'bash' from killing processes that trap ^C
I have a console-mode Windows application (ported from Unix) that was originally designed to do a clean exit when it received ^C (Unix SIGINT). A clean exit in this case involves waiting, potentially quite a long time, for remote network…

zwol
- 135,547
- 38
- 252
- 361
32
votes
4 answers
How can I write to the console window for debugging?
Can I display the result of a loop in the console window in a VCL application for debugging purposes?

emurad
- 3,448
- 10
- 40
- 47
31
votes
3 answers
Windows echo command can't echo a user-set variable
What did I do to screw up my CMD shell? Windows XP Pro, open a cmd window and do:
C:\>set tt = name
C:\>set tt
tt = name
C:\>echo %tt%
%tt%
C:\>echo %time%
14:13:28.67
The echo command doesn't work for some reason. I can echo the built-in…

jacobsee
- 1,438
- 4
- 18
- 34
30
votes
7 answers
Use "cmd /c" but hide the console window
I have a shortcut running this command when clicked: cmd /c "full path to my batch file". When I use it, it does what it is supposed to do, but in the process the ugly console window pops up. Is there any way to make this command start a hidden or…

kno010
- 411
- 1
- 4
- 5
29
votes
3 answers
Getting terminal size in c for windows?
How to check ymax and xmax in a console window, under Windows, using plain c?
There is this piece of code for linux:
#include
#include
int main (void)
{
struct winsize max;
ioctl(0, TIOCGWINSZ , &max);
printf…

DrBeco
- 11,237
- 9
- 59
- 76
28
votes
1 answer
How do you stop a Windows Batch file from exiting early?
I have a windows batch file that looks similar to:
C:\DoStuff.cmd
move output.bak C:\newfolder\output.bak
The problem i have is that DoStuff.cmd executes a java program that once complete exits the batch run back to the command prompt. Line 2 never…

Doug
- 6,460
- 5
- 59
- 83
28
votes
4 answers
How to use the new support for ANSI escape sequences in the Windows 10 console?
The latest Windows 10 updates include support for ANSI escape sequences in conhost.exe.
I have been able to confirm that the escape sequences are properly picked up in cmd.exe, so I have the necessary updates. In particular, I tried typing in…

bzm3r
- 3,113
- 6
- 34
- 67
23
votes
8 answers
Which font is used in MS-DOS?
Does anyone know which is the font that the Windows console/MS-DOS uses?

federico-t
- 12,014
- 19
- 67
- 111