How to hide terminal shell on server application?

I have a small warp server project on Windows that listen to a particular port and do something whenever I send a command to it by REST (for example: POST http://10.10.10.1:5000/print). It's a small client for printing PDF / receipt directly from another computer.

It works. But my problem is when I had to package the whole project, the Rust compiler give me an executable file (.exe). The application displays a terminal window when I run it. I want this terminal to be hidden somehow.

Screenshot_20

I try to run the program as a windows service (by using NSSM). It doesn't work for me since I had to access the printer. Windows doesn't allow my app to access any devices or any other executable as a windows service. (The reasons are explained here: .net - How can I run an EXE program from a Windows Service using C#? - Stack Overflow)

So I plan to run my app as a tray-icon application. (GitHub - olback/tray-item-rs: Multi-platform Tray Indicator)
Unfortunately, I still cannot hide the app's terminal window.

Screenshot_21

Do anyone know how to hide or get rid of it ?

On windows, whether the console will be shown or not when a program is run is set at build time.

With rust the dedicated attribute windows_subsystem can change it: The Rust runtime - The Rust Reference

2 Likes

nahh forget about it... #![windows_subsystem = "windows"] works!!!! thank you!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.