Re: Script Not Totally Working in Scheduled Tasks

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Sleep steals CPU time and keeps a process open all the time,
can't you just issue another AT command inside the script ?

This script will create a new scheduled job every one minute...

Change the 1/1440 to something more appropriate

for 1 minute - 1/(60*24)
for 5 minute interval use 1/(1440/5)
for 10 minutes use 1/(1440/10)

call this anything.bat that you want to...

It's currently designed to run from the c:\ folder
look for this in the script:
At %v_input% /interactive "c:\%0"


@ECHO off
SETLOCAL
SET v_vbs=%temp%\~tmp.VBS
SET v_cmd=%temp%\~tmp.cmd
ECHO Set oFS=CreateObject("Scripting.FileSystemObject")>%v_vbs%
ECHO tim=FormatDateTime(now+1/1440,vbShortTime)>>%v_vbs%
ECHO oFS.CreateTextFile("%v_cmd%",2).Write "set v_input=">>%v_vbs%
ECHO oFS.OpenTextFile("%v_cmd%",8).Write tim>>%v_vbs%
cscript.exe //nologo %v_vbs%
CALL %v_cmd%
DEL %v_vbs%
DEL %v_cmd%
SET v_input
ENDLOCAL & SET v_input=%v_input%
:: place your actual commands here...
At %v_input% /interactive "c:\%0"

hth,

D.



smoochi3@xxxxxxxxx wrote:
You can always run the script when windows boots up and then have it
sleep for 5 minutes.

Sean Grieco wrote:
Ok, so the "interactive" in AT worked nicely, however I do not see anywhere
that I can have it run every 5 minutes, it is just based off daily....

Can I run the AT command to run every 5 minutes or so?



"Jason" <flajason@xxxxxxxxx> wrote in message
news:1162927029.256174.279850@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You pretty much solved it yourself based on your description of the
problem.
Unlike the RunAs command, when you run a scheduled task as another user
it does not run interactively. Any part of the task that requires user
input will not be displayed. I'd recommend removing any message boxes,
or recode it to use the Popup method instead, so you can at least set a
timeout on the response.

- Jason
Sean Grieco wrote:
Hello,

I have a script here that runs every 5 minutes in scheduled tasks. The
script checks to see if the pc has a certain ip address and if it does it
disables the dhcp client and displays a message. The problem is I have
the
task scheduled to run w/ the administrator's credentials. And unless the
administrator is the one signed in to the pc, the dhcp client will
disable
but the message box does not display on the screen. It will give the
message beep however. Then the task continually says "running" because
it
is waiting for the user to hit "ok", yet the user can not see the message
box.

What am i missing?

Any help will be greatly appreciated.

.



Relevant Pages