Open my Program at background in Windows

I have a little program in rust, i wan't to know how to run in background if i do double click de CMD is Open and still Open at the end of the process.

I want to run this same Program but On Background:

I see how to run a Command in background but i don't want to run new process!!! is the same Program in background!

Use #![windows_subsystem = "windows"] at the top level of your program to avoid the console.

https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute

3 Likes

I am trie to this and get error: an Inner attribute is not permitted in this context.

It's only allowed as a top-level attribute of a binary crate, like the beginning of src/main.rs.


My friend am using this into main.rs at the top... am working whit tokio i don't know if this is the problem =/

Pull it to the top, before the mod and use statements.

1 Like

Not top of main function, but top of that file. Literally the first line in that file, before everything else.

2 Likes

Thanks all for the help!