Time loop with cmd.exe or Powershell?

hellosky

Weaksauce
Joined
Mar 28, 2010
Messages
111
I need to run a command every 5 minutes. How can I do this with the command prompt or via powershell?

it will run the command "git pull origin", wait 5 minutes, and run it again. This batch should NOT exit (always be running). it has to be in a batch or powershell script, NOT via task scheduler.

any tips or tricks? thanks.
 
First, you'll want to look in to creating a Windows Service that manages your script.
 
Do you really want to do a git pull every five minutes? I can tell you how to, but it seems rude to whoever is maintaining your github.
 
Yes, it's perfectly fine with them. Do I really need a service? I was gonna create an account and just run the script from there...
 
What are you actually trying to accomplish here? Are you trying to set up a mirror? Do continuous deployment of a codebase?
 
I'm trying to do a continuous refresh of the codebase from git so I wanted to pull every 5 minutes.
 
Bad idea. Deployments should be manual - a fully automated deployment gives you no chance to do staging or QA.
 
It's still unknown what environment is being refreshed, let alone what the files/project actually are. (Not to mention why a sync with the hub is needed every 5 minutes.)

This whole thread reads like the tip of an iceberg.
 
It's your business, here's how:

(powershell script, btw)
Code:
while ($true)
{
     # put your command here that you want to run every five minutes.
     sleep -seconds (60*5)
}

Very simple. If you want a script that runs the script without a taskbar icon or desktop window, i.e. hidden, I can give you that as well.
 
Last edited:
Back
Top