-4

I want to run a program with a delay of 10 minutes. I used the Process to run the program, but after 10 minutes I could not run the command. Could you help me?

        Process scriptProc = new Process();
        scriptProc.StartInfo.FileName = @"C:\a.vbs";    
        scriptProc.Start();
        scriptProc.WaitForExit();   
        scriptProc.Close();
Mithgroth
  • 1,114
  • 2
  • 13
  • 23
Emresan
  • 1
  • 2

1 Answers1

0

You can use Timer to wait 10 minutes and then executing your code. This is the correct usage of Timer: https://stackoverflow.com/a/12535731/506128

I do recommend going with the Timer, since 10 minutes of Thread.Sleep() is absurd.

Mithgroth
  • 1,114
  • 2
  • 13
  • 23
  • Well, yeah. It's still a way of doing it, and I also mentioned my view on it. It can reference someone else reading this question in the future. Someone who doesn't want to wait 10 minutes but a few seconds maybe. – Mithgroth Jan 10 '18 at 09:39
  • Also that's how you learn the differences between two similar ways. – Mithgroth Jan 10 '18 at 09:40
  • What you need to understand is that people won't read everything. They'll see `Thread.Sleep()` and off they go –  Jan 10 '18 at 09:46
  • Aight then, I'll update. However this is more of a discussion instead of arguement. I'd rather have reasons before acting :) – Mithgroth Jan 10 '18 at 10:01
  • Goodo, hard to tell sometimes on SO. Thanks very much good sir :) –  Jan 10 '18 at 11:19