Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi,

How to execute the c++ program for a specific period of time...

regards,
sanath
Posted
Comments
Mehdi Gholam 26-Sep-11 1:44am    
What do you mean?

Ctrl+Alt+Delete -> Task Manager…? :-)

Or perhaps run it via System.Diagnostics.Process.Start which will return you the instance of System.Diagnostics.Process. In parent process, use System.Threading.Thread.Sleep for required amount of time and them call Process.Kill using this instance. :-)

See http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^].

Now, your problem is that you don't explain your ultimate goal. I'm almost sure you never need to "execute the C++ program for a specific period of time". Could you explain why?

—SA
 
Share this answer
 
v2
In case you want to run an executable at a specific time, you can use Windows Scheduler[^]. You can schedule to run batch file to scripts to executables using this mighty application which comes along with Windows.

Or you can use AT[^] command to schedule a task from command line.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900