We help IT Professionals succeed at work.
Get Started

need simple standalone batch script to create cmd shell, run exe, sleep 6 seconds

2,542 Views
Last Modified: 2010-04-21
Hi SysAdmins & VBScript Folks,

Thank you for a moment of your time.

I'm running a program called SyncBackSE, which runs some very cool FTP stuff as a background task every 6 seconds while I'm logged on.

The problem is that when I log off, the background task will no longer run, and the smallest possible increment for scheduling tasks in Windows Task Manager is one minute.

I need a very simple standalone VBScript (not embedded in an asp or other page), which will run on a server I have.

Ultimately, I need to run this line:
"C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe" -m "funny name goes here"

I need to run the above line every 6 seconds, for 24 hrs a day, 7 days a week, 365 days a year.

The solution I've devised is to create a Windows task scheduler task that kicks off a vbscript every 1 minute, repeatedly, indefinitely, daily.

It will kick off the vbscript, and the vbscript will execute the line I've pasted above, with the .exe in it.
This vbscript should run this line once, then sleep for 6 seconds, and then do it again for 10 loops (probably do while) ..... in other words, 10 times per minute, or once every 6 seconds.

This way, if the script gets hung for any reason, it will be restarted again once every minute, when the task manager kicks it off.  (I'm wondering if this is the most reliable way to keep this going without hickups or hangs).

Obviously, I want this to run all the time, not just when I'm logged on as Admin.

Don't forget to escape any characters (quotes?) that may need it in the execution of the binary file (you can probably substitute notepad.exe or some other binary since you may not want to download and test with SyncBackSE).

PLEASE provide me a very simple vbscript that WORKS, for 500 easy pts.  

Thanks so much!,
~k


create command shell and supress debugging/errors/popups
 
i=1
Do While i < 11
     "C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe" -m "funny name goes here"
     WScript.Sleep 6
      i = i + 1
Loop
clean up and exit

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 3 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE