How to "Clear the Screen" for Windows Command Processor? (Windows 10)

Jim jimwoo21680 at hotmail.com
Tue May 21 09:33:10 UTC 2019


On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote:
> I'm getting unsure why executeShell works on the pause command, 
> but cls that is responsible for clearing the text do not.
>
> import std.stdio, std.process;
> void main()
> {
> 	writeln("Some text that will appear in cmd");
> 	executeShell("cls"); // Does not clear the text?
> 	executeShell("pause"); // Pauses the cmd.exe to keep from 
> closing itself.
> }

As far as I understand [1], executeShell starts a new shell and 
executes %command% in that shell. So cls wouldn't be called in 
the shell where you wrote Some text...

[1] https://dlang.org/phobos/std_process.html#.executeShell


More information about the Digitalmars-d-learn mailing list