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
6
votes
1 answer
Groovy: using ampersand in command line parameter
Here is the groovy script:
param = args[0]
println(param)
Here is how I run it (Windows 7):
groovy test.groovy a&b
I expect this script prints a&b, but instead get 'b' is not recognized as an internal or external command, operable program or batch…

Racoon
- 951
- 3
- 14
- 32
6
votes
2 answers
How do I set an environment variable to a value with spaces in a batch file?
I don't know how to describe exactly what I'm trying to do but here's an example batch file that demonstrates what I can't figure out.:
I've got a batch file. Inside that batch file I'm trying to create a directory:
Set CopyFrom = %~dp0
if Exist…

BobTheBuilder
- 2,455
- 2
- 27
- 39
6
votes
3 answers
How to tell Git I'm upgrading php?
I've just upgraded PHP to the latest version. When I get back to Git, to my command shell, if I execute any PHP function, then I get this error :
sh.exe": php: command not found
I know I have to tell git bash where my new PHP path is, but I don't…

Miles M.
- 4,089
- 12
- 62
- 108
6
votes
2 answers
Python: Emit some Utf-8 string to windows console
Possible Duplicate:
Python, Unicode, and the Windows console
I read some strings from file and when I try to print these utf-8 strings in windows console, I get error
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0: ordinal…

Meloun
- 13,601
- 17
- 64
- 93
5
votes
2 answers
How do I write special characters (0x80..0x9F) to the Windows console?
I would like to have this code:
System.Console.Out.WriteLine ("œil");
display œil instead of oil as it does in my test program.
The Console.OutputEncoding is set by default to Western European (DOS) (CodePage set to 850 and WindowsCodePage set to…

Pierre Arnaud
- 10,212
- 11
- 77
- 108
5
votes
2 answers
Print and store spanish characters (á, é, í, ñ...) in cmd
I'm using Microsoft Windows 10 with mingw-w64 (gcc version 8.1.0, x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) with cmd. When I try to print or store and then print a Spanish character on the Windows console, it shows an error. For example I…

Rafael Hernández Marrero
- 129
- 10
5
votes
2 answers
Box drawing characters in batch scripts (Windows CMD)
I would like to display box characters (single o double line)in batch scripts that are aim to run on Windows CMD environments (XP,7,8 and reactOS). These symbols for "boxes" are specified in code page 1252.
From script I am setting the necessary…

Daniel Perez
- 431
- 5
- 11
5
votes
4 answers
Python.exe opens in a new console window
I used to run Python scripts from my Windows command line, and all the prints were printed in the same console. Now something happened on my machine (Windows 10), and when I launch a Python script from the command line (i.e. open a Command Prompt…

Francesco Pistelli
- 51
- 1
- 2
5
votes
3 answers
Why can't I redirect output from WriteConsole?
In the following program I print to the console using two different functions
#include
int main() {
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD byteswritten;
WriteConsole(h, "WriteConsole", 12, &byteswritten, NULL);
…

rtpax
- 1,687
- 1
- 18
- 32
5
votes
3 answers
Console beep character code - wrong number?
ASCII character code 0x07 is a beep character.
Opening CMD and clicking ALT + 007 yields :
And when I click ENTER - I hear a beep. This is fine.
I've searched how to add a beep in the end of a batch file, and I found that this is the solution :…

Royi Namir
- 144,742
- 138
- 468
- 792
5
votes
0 answers
Changing the focus back to the console window
My knowledge of Windows programming is close to zero. But now I have made a Forth program running from the console in Windows which opening a primitive window for graphics. The problem is that I want to control the program by pressing keys, but when…

Lehs
- 812
- 6
- 18
5
votes
2 answers
Get cursor position via Windows 10 console VT-100 escape sequence
I'm playing around with the new (limited) support for VT-100 escape sequences within the Windows 10 console. The supported sequences are documented at https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx.
In particular,…

dbenham
- 127,446
- 28
- 251
- 390
5
votes
1 answer
Windows console application - signal for closing event
In windows console application, one can catch pressing ctrl+c by using:
#include
#include
void SigInt_Handler(int n_signal)
{
printf("interrupted\n");
}
int main(int n_arg_num, const char **p_arg_list)
{
signal(SIGINT,…

the swine
- 10,713
- 7
- 58
- 100
5
votes
3 answers
PowerShell Issue with Get-Content
I have an issue. When I run a command:
powershell -command "gc C:\Program Files\Microsoft SQLServer\MSSQL.1\MSSQL\LOG\ERRORLOG -totalcount 5
There is an error:
"Get-Content : A positional parameter cannot be found that accepts
argument…

Jade
- 283
- 3
- 9
- 18
5
votes
3 answers
'GetConsoleWindow' was not declared in this scope?
#include have already added, so why the GCC-mingw32 Compiler reported that 'GetConsoleWindow' was not declared in this scope ?
Here's my code:
#include
#include
#include
using namespace std;
#define PI…

Kevin Dong
- 5,001
- 9
- 29
- 62