Windows equivalent for Linux "screen" or other alternative?

I am in search of a method for managing programs in a Windows environment.

I would prefer it to be a bit like Linux screen software.

The reason for my search is that I need to run the program (on Windows) with the identifier, so later I can close this particular program without closing anything else, even if the actual program (.exe file) works several times. Anyway, can I "name" him?

Now I use the following on Linux:

 $ screen <params> <id> ./softwareprogram 

And then I know that I can always find his ID with him :)

This is an external program that closes or launches a third-party program.

My program is written in C ++, if that makes any difference.

Edit: Can I somehow not independently select the identifier? How to run a program with a specific name? Also, how can I kill a process by specifying a name?

+8
linux windows gnu-screen
source share
3 answers

When you start the program, you can get your process ID even in windows. You can use this process identifier later to kill the program again.

If you need to specify your own identifier, you can use, for example. in the registry to store the display of your identifier to handle the identifier. If you get a start command, save the identifier in the registry as a key and the pid of the running process as a value. If you get a stop command, extract the pid from the registry and kill that pid and remove the key from the registry.

Instead of the registry, you can of course use a database or a folder with files in which the key (your identifier) ​​is the name of the file and the pid is inside each file.

+1
source share

At the moment, I do not believe that there is a native equivalent of the screen. Cygwin contains a screen implementation, but it is related to cygwin overhead. The problem is that Windows and Posix-based operating systems implement consoles in a completely different way. Windows does not support many of the tty functions that are part of the POSIX environment. In this case, it may be possible to write a minimal implementation of functions in the screen utility using API calls: AttachConsole and FreeConsole . However, I would have to do some more research on this.

+1
source share

While I don't know what the linux screen command does, why don't you just use the process descriptor from CreateProcess ?

You also get the process identifier, but its valid only as long as it has no open descriptors.

The lpProcessInformation parameter will contain both the process identifier and the process descriptor.

-2
source share

All Articles