running task scheduler as administator

ed rosenthal 1 Reputation point
2021-10-16T19:13:18.017+00:00

i am trying to run a batch job in task scheduler, but when i run as me
i get operational code 2.
running the batch file in cmd is fine.
so it must be privileges?
and yet if i try to run ad administator ( with my machine name prefix and slash )
i have to have a password.
this machine was setup for me, and i do not know how to continue.
assist / suggestins?

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. ed rosenthal 1 Reputation point
    2021-10-16T22:21:36.847+00:00

    the task scheduler allows for browsing to the bat file, so i don't know why opcode 2 would be given for it.
    the bat file looks like this
    cd/
    cd/xampp
    cd php
    php \xampp\htdocs\iwp2\v3\cron.php
    cd/
    cd/users/ed/desktop
    echo %ERRORLEVEL% >cronjob-output.txt
    echo %time% >>cronjob-output.txt

    is there something obvious for you here?

    0 comments No comments

  2. MotoX80 36,291 Reputation points
    2021-10-16T22:43:44.14+00:00

    In this post...

    https://learn.microsoft.com/en-us/answers/questions/576810/scheduled-tasks-start-6-hours-late.html

    ...refer to my "Oct 04 2021 at 7:46 PM" answer where it describes how to configure the task to capture stdout and stderr so that you can review the log file for output and errors. Use your file and folder names obviously.

    0 comments No comments

  3. ed rosenthal 1 Reputation point
    2021-10-16T23:02:32.843+00:00

    i used to run korn, bourne and cshell scripts no problem.
    but this simple exercise is no fun.
    i believe i can make it work but as administrator, since when i did that i saw at least an opcode of 1 and not 2.
    so now my question is how do i run this little tiny time consuming two line as administrator,
    when when asked i have no idea what the password is?


  4. ed rosenthal 1 Reputation point
    2021-10-17T17:19:37.857+00:00

    i created a new task to run the bat file cron_job_for_iwp.bat
    the action is
    cmd.exe and its arguments ( in the separate area for arguments,
    not sure if i should have said yes or no when asked about them)

    /c C:\Users\Ed\Desktop\cron_job_for_iwp.bat 1> C:\Users\Ed\Desktop\logs\cronjoblogs.txt 2>&1

    cron_job_for_iwp.bat file has in it:
    c:\xampp\php\php.exe c:\xampp\htdocs\iwp2\v3\cron.php

    the output file was
    C:\WINDOWS\system32>þc
    'þc' is not recognized as an internal or external command,
    operable program or batch file.

    i feel i am halfway there. lol.

    0 comments No comments

  5. MotoX80 36,291 Reputation points
    2021-10-17T21:54:19.087+00:00

    Open the bat file with notepad and do a file saveas and save it as plain old ascii. You've got it in some other encoding. That's what those first 2 characters indicate..

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.