How to stop loop

I have a a DFrobot Arduino and i want the motors to to run within a certain amount of time so i put it in a for loop but the loop never stops. How can i make it to stop?

int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M1 Direction Control

void setup(){

int i;

for(i=0;i<=9;i++)

{
analogWrite (E1,100); //PWM Speed Control

digitalWrite(M1,HIGH);

analogWrite (E2,100);

digitalWrite(M2,HIGH);

}
}

void loop(){

}

Read how blinky without delays work, then just use a time of the desired duration and then it stops being executed.

In your loop, you set the direction and speed for each motor to identical values 10 times. How does that differ from doing it once?

Where do you turn the motors off?