Re: For Function with Pipe Problem.

From: BaKaR (bakar_at_metro-cc.DnotSpamMe.hr)
Date: 03/24/04


Date: Wed, 24 Mar 2004 15:14:38 +0100

Hi!

OS: WinXP Pro.

Tasklist.exe: C:\windows\system32\
Kernrate.exe: C.\program files\MS Resource Kit\Tools\kernrate.exe

Both are in the "Environment Variables">"System Variables"

Im using echo and 2>>, just i gave you part of "almost" finished problem.

Well, im using schtasks.exe (WinXP/Win2K3 at.exe) command which is working very well.

schtasks /create /sc minute /mo 5 /tn "test" /tr c:\scripts\test.cmd /ru System

So, it will put the task in the background process and execute it every 5 minutes with NTAuthority\System privilages/permissions.

If i run the script, i tested, with my account (local Admin) it works fine, still, if ran with that schtasks and system account,
aint working ...

-- 
-------;.Wo0o0oS!h:..
!#!Int3RGAlaCTic Fu!x!#!:..
=!:MESING a.k.a. BaKaR a.k.a BR4iNL355:..
-------;.Ca0Tic EXp:..
*. Remove: "DnotSpamMe" When R_ing.
"Marty List" <bill.gates@sun.com> wrote in message news:c3s215$2aeiod$1@ID-172409.news.uni-berlin.de...
>
> "BaKaR" <bakar@metro-cc.DnotSpamMe.hr> wrote in message
> news:c3rsov$3ea$1@brown.net4u.hr...
> > Hi!
> > I have a problem with a *.cmd batch script.
> > If i run it "on click" it is working, but if i run it with "schtasks.exe"
> and "system" user (in background) its not running one of
> > the two for functions:
> >
> >
> > @echo off
> >
> > for /f "tokens=2" %%i in ('tasklist ^| findstr /i aplication') do (
> > echo %date% %time% Info.PID: %%i >> file.log
> >
> > for /f "tokens=4" %%k in ('kernrate -p %%i -s 2 ^| findstr /C:"User
> Time"') do (
> > echo %date% %time% Info.CPU: %%k >> file.log
> >
> > if %%k GTR 40.0% (
> > echo %date% %time% "CPU OverUse Positive ( %%k )" >> file.log
> > call taskkill /pid %%i /F
> > )
> > echo Out_1 >> file.log
> > )
> > echo Out_2 >> file.log
> > )
> > echo %date% %time% "Finished!" >> file.log
> >
> > So, the problem is happening in for function where i use kernrate and
> findstr. If i run the batch "on click", everything is working
> > well, but if im using schtasks.exe with system user that part of the batch
> is skipped (also, i cant see echo Out_1) ?! or something,
> > cauze i cant see its run, every echo i set in front, or after is initiated
> (again, except Out_1).
> >
> > Any ideas ?
> >
> > Thank You,
> >
> >
> > *. Remove: "DnotSpamMe" When R_ing.
> >
> >
>
>
> Which OS are you using?
>
> Where is tasklist.exe located?  Is this folder in the PATH of the SYSTEM
> account?
>
> Where is kernrate.exe located?  Is this folder in the PATH of the SYSTEM
> account?
>
> While you're troubleshooting, comment out that @Echo Off.  That makes it
> look nicer but it's hiding a lot of good troubleshooting info from you.
>
> The >> redirection is only redirecting standard output to your file.log.
> You're not seeing any error output, add " 2>>errors.log" or " 2>>file.log"
> like this:
>   for /f "tokens=2" %%i in ('tasklist ^| findstr /i aplication') do (
>   echo %date% %time% Info.PID: %%i >>file.log 2>>file.log
>
>
>
>


Relevant Pages

  • Re: For Function with Pipe Problem.
    ... If i run the batch "on click", ... i cant see echo Out_1) ?! ... look nicer but it's hiding a lot of good troubleshooting info from you. ... The>> redirection is only redirecting standard output to your file.log. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Persisting env vars in cmd windows
    ... But the piece de resistance was the "start" command, ... - Have all code for the one project in one single batch file. ... @echo off ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Batch File to manipulate path and file name
    ... It should process any "poison" characters ... # echo Full name=%%a ... If you object to requiring two files to achieve your aim (one batch, ... How do I get from Input File Name to Output File Name Desired? ...
    (microsoft.public.windowsxp.general)
  • Re: File Size Check
    ... the batch ended and was done. ... del para2.txt ... echo open ... SLEEP is part of the WinNT/2K/XP/2003 Resource Kit and not a ...
    (microsoft.public.scripting.vbscript)
  • Re: del not working in .bat file
    ... Haven't managed yet to do away with the .bat file and run this: ... Try using the CALL command inside the batch file. ... @echo off ... executes, which calls test2.bat and that executes. ...
    (microsoft.public.vb.general.discussion)

Loading