I have a 7 line script, with one loop. please debug it and make it work for 500 quick pts

this is a standalone script, I am scheduling to run once per minute on a server.
It opens the command window, but apparently does not run the .exe
Please make it work, including the switch, and post back
set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
  wsobject.run('"C:\\Program Files\\2BrightSparks\\SyncBackSE\\SyncBackSE.exe" -m "FTPWebcam"',0,"TRUE")
  wscript.sleep 6000
  i=i+1
loop

Open in new window

ksuchyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jazzIIIloveCommented:
ksuchyAuthor Commented:
please fix my script.  I'm not looking for alternatives, and don't have time to debug myself.
Shift-3Commented:
This should work.


set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
    wsobject.run Chr(34) & "C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe" & _
        Chr(34) & "-m " & Chr(34) & "FTPWebcam" & Chr(34),0,"TRUE")
    wscript.sleep 6000
    i=i+1
loop

Open in new window

Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

jazzIIIloveCommented:
>>am scheduling to run once per minute on a server.
If a windows server, follow the shots...

best regards...
VBSTask1.JPG
VBSTask2.JPG
VBSTask3.JPG
rejoinderCommented:
You can try this too...
set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
  strEXE = """C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe"" -m ""FTPWebcam"""
  wsobject.run strEXE,0,TRUE
  wscript.sleep 6000
  i=i+1
loop

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ksuchyAuthor Commented:
Jazz & ReJoinder,

Ok, I'm much closer now, so thanks to both of you.  However, there remain a few issues.  In Windows Server 2003 task manager, "the duration must be longer than the repetition interval".  Frankly, it doesn't make sense to me WHY, but that's the message if you try to set it for 1 minute repetitions, and duration 1 minute.  

So I ran 3 tests:
(1) set it to run every 1 minute, for a duration of 2 minutes, but it stops after one iteration and I don't think the task is attempting to run a second time from task scheduler,
(2) even if I click the box that reads "if the task is still running, stop it at this time" it still never kicks off a 2nd time
(3) then I also added the "Stop this task if it runs for 2 minutes" on the settings tab

I AM ABLE to verify that the script does successfully run through once (that SyncBackSE.exe executes with the appropriate FTP switch 9 times.

Is there something about how you need to end the script, perhaps to release the wscript host or some other components/variables?

My last line is verbatum yours, "Loop".

Thanks,
~k
rejoinderCommented:
I suggest that you set up the loop so that it will never end - comment out the line;
i=i+1
This will loop the script forever.
In the Task Manager window, set up the script to run at system startup and blank out the check box to stop the script after 72 hours.
What will happen is the system boots up, runs the script which will loop every minute.  The script will continue to fire every minute until you stop the task.
ksuchyAuthor Commented:
Hi ReJoinder,

Thanks, it seems to be working now, but once again, only as long as I'm logged in.
When I log off, I get a very brief window that reads,

SynBackSE.exe - DLL Initialization Failed
"The application failed to initialize because the window is shutting down."

While logged off, it doesn't run at all now, and when I log back on, this window is right on top, like the script is hung.

Regards,
~k
rejoinderCommented:
Try running the task as a local admin account (you might need to create an account just for this purpose)  not the account you use to log in as.  This should start the script without it being visible since it will run as that other account.  When the script fires, the exe should be running under the context of the other account and should not be visible to the logged in user.  Logging out will not affect the script running.
ksuchyAuthor Commented:
Got it working.  I set the task to daily repetition once per day at 8 am, with a duration of 23 hrs 59 minutes.
rejoinderCommented:
Glad to know the script is running well now.
ksuchyAuthor Commented:
Thank You :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.