Jump to content

Running exe file in the background on Windows Startup

rm -rf

I've got a C++ bit of code like this:

#include <iostream>
using namespace std;

int main()
{
  cout << "hello world!";
}

 

 

It's compiled as an .exe, how can I get this to launch without showing anything?

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

removing 

cout << "hello world!";
Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, dexxterlab97 said:

removing 


cout << "hello world!";

I still want the code to run, I just don't want to see it.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, rm -rf said:

I still want the code to run, I just don't want to see it.

minimize it?

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, dexxterlab97 said:

minimize it?

Though then it's in the task bar, I don't want to see it.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, dexxterlab97 said:

minimize it?

 

I believe he's meaning something more like the application runs in the background without a window or tray icon.

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, TheKDub said:

 

I believe he's meaning something more like the application runs in the background without a window or tray icon.

I'm okay with a tray icon as long as it can be in the "hidden icon" section.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

Depending on what your program does you could use the task scheduler to start the program as some other user.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, dexxterlab97 said:

it will start minimized and you need command prompt

http://www.computing.net/answers/windows-7/program-autostart-and-hide-to-system-tray-or-background/16820.html

 

You need autohotkey

Let's say the .exe I compiled from the .cpp file was at C:/.

What would I do to use auto hotkey?

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, fizzlesticks said:

Depending on what your program does you could use the task scheduler to start the program as some other user.

Will this work if I don't have access any other user accounts on my computer?

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, rm -rf said:

Will this work if I don't have access any other user accounts on my computer?

You'll need access to some other account, it could be the SYSTEM account or Administrator or a new account you make (maybe even the guest account but I don't know about that one.)  But without knowing what your program is trying to do I can't say if this idea will even work at all.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, fizzlesticks said:

You'll need access to some other account, it could be the SYSTEM account or Administrator or a new account you make (maybe even the guest account but I don't know about that one.)  But without knowing what your program is trying to do I can't say if this idea will even work at all.

I can't create new accounts or use other accounts.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

You can run it as a Windows service. You can write Windows service installers in C++ (those are some boilerplate code basically) into your application, or you can use NSSM.

 

EDIT: This will require Administrator account access, unless you have permissions to manage services.

 

Another option is to instead of a Console application, make a Windows application that produces no Windows, you could make it in a way that it will not appear anyhow.

Link to comment
Share on other sites

Link to post
Share on other sites

This idea seems off to me.

 

Firstly you can't create account implying you do not own the machine and you're trying to male it invisible to the end user.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

47 minutes ago, DevBlox said:

You can run it as a Windows service. You can write Windows service installers in C++ (those are some boilerplate code basically) into your application, or you can use NSSM.

 

EDIT: This will require Administrator account access, unless you have permissions to manage services.

 

Another option is to instead of a Console application, make a Windows application that produces no Windows, you could make it in a way that it will not appear anyhow.

I do have Administrator permissions, though I think im going just going to code it as a windows application.

Thanks

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, vorticalbox said:

This idea seems off to me.

 

Firstly you can't create account implying you do not own the machine and you're trying to male it invisible to the end user.

I'm the only user who uses this machine, so don't worry, I'm not trying to do this for nefarious purposes xD (though if I was would I say?...)

This is just apart of a project to automatically calculate how long it will take for windows 7 extended support to run out and update my forum signature.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×