Hey can anyone tell me how to make a program that i can have a cmd in the cmd to exacute over and over waiting 1 minute each time?

Sorry, I didn't get you, but can you please clarify more, give me example of your problem

hey thanks ok when i am in the command propmt i tpye in a command .. so then i wanna do this command over and over ever 1 min so how do i do that? and make it go non stop.

thanks for repliey

you should have a method take a string as a parameter and execute it as command like

void Execute(char* command)
{
system (command)
}

and infinite loop in another thread let me write the pesudo code for it
for( ; ; )
call Execute stop this thread for 10 seconds

Hey sorry.. i dont fallow too much i am new to C++ so lets say i wanted to open C:/programfiles/bh/hed.exe

and open it every 90 secs what would i do??

sorry i am a newbie :D

Well since you seem to be using windows, there are already a couple of ways built in to do this.

1. Use the 'at' command

$ at /?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername     Specifies a remote computer. Commands are scheduled on the
                   local computer if this parameter is omitted.
id                 Is an identification number assigned to a scheduled
                   command.
/delete            Cancels a scheduled command. If id is omitted, all the
                   scheduled commands on the computer are canceled.
/yes               Used with cancel all jobs command when no further
                   confirmation is desired.
time               Specifies the time when command is to run.
/interactive       Allows the job to interact with the desktop of the user
                   who is logged on at the time the job runs.
/every:date[,...]  Runs the command on each specified day(s) of the week or
                   month. If date is omitted, the current day of the month
                   is assumed.
/next:date[,...]   Runs the specified command on the next occurrence of the
                   day (for example, next Thursday).  If date is omitted, the
                   current day of the month is assumed.
"command"          Is the Windows NT command, or batch program to be run.

2. From the control panel, choose "Scheduled Tasks" then "Add Scheduled Task" and follow the prompts.

hmm... but what i mean is in the command prompt i tpye in C:/programfiles/blahblahblah so i hit enter. it opens the .exe. So when i hit the arrow up botton it has the same cmd in it.. so what i wanna do is have that arrow go up and exeute it every 90 seconds... so how would i do that?

thanks alot like i said i am new to the whole programing stuff.. I am a 3d arist but this is somthing i wanted to pick up for along time.. thanks.

while(true) 
{
      system("<yourcommand here>");
      Sleep(90000);//have to include windows.h I think
}

hmm... but what i mean is in the command prompt i tpye in C:/programfiles/blahblahblah so i hit enter. it opens the .exe. So when i hit the arrow up botton it has the same cmd in it.. so what i wanna do is have that arrow go up and exeute it every 90 seconds... so how would i do that?
.

You can't do that directly from the cmd prompt like you described unless you use a scheduler and have it run the command every so often as described by Salem in an earlier post.

The other alternative is to execute the program from the cmd prompt just once and have it do its stuff repeadetly forever -- using loops, something like this: [edit]which is nearly the same as Sturm posted[/edit]

#include <windows.h>
int main()
{
    for(;;)
    {
         // execute some code here, not shown
         do_something();
         // wait one second
         Sleep(1000);
    }
    return 0;
}

where do i find the windows.h?

sorry lol i am big time noob huh?

In your Include directory, if you don't see it, go and set it from your IDE settings->Include Directory and then set the path.

lol
what u mean how do i get there?

IDE settings->Include Directory

IDE =?

Perhaps it would be a good idea to first establish which C++ compiler you have.

just use Ancient Dragon's code but replace Sleep(1000) with Sleep(90000).

Hey can anyone tell me how to make a program that i can have a cmd in the cmd to exacute over and over waiting 1 minute each time?

just use Ancient Dragon's code but replace Sleep(1000) with Sleep(90000).

one minute is 60000 milliseconds, not 90000.

Where to find windows.h on your hard drive depends on what compiler you have. Many compilers don't have it at all and you have to download the (free) Microsoft Windows Platform SDK from Microsoft web site. Its pretty large so if you have a slow internet connection you might want to get it on CD for nominal cost.

Hey can anyone tell me how to make a program that i can have a cmd in the cmd to exacute over and over waiting 1 minute each time?

Hey sorry.. i dont fallow too much i am new to C++ so lets say i wanted to open C:/programfiles/bh/hed.exe

and open it every 90 secs what would i do??

one minute is 60000 milliseconds, not 90000.

I know.

K i D\L it soo i see it in the HD but i have to put it anywhere? Its red so icant compile it.. how do i fix it?

Where is it on your hard drive? On my hard drive its in include directory with a lot of other windows header files and libraries. windows.h is not a stand-alone header file but requires several other windows headers also. I have no idea what K i D\L is, but whatever it is it will probably recognize the /I option flag to identify the full path where include fles are located.

lol its ok i downloaded it lol :P

but where the heck is the Include directory lol


do u have aim or msn lol? this will make it much better.. mine aim starjsjswars and my msn is <email snipped>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.