• Scheduling a .BAT script has me confused (XP Home)

    Home » Forums » AskWoody support » Windows » Windows Vista, XP and earlier » Questions: Vista, XP back to 3.1 » Scheduling a .BAT script has me confused (XP Home)

    Author
    Topic
    #388359

    confused I’ve created a backup batch file, called “backuplog.bat” which runs fine from the command prompt.
    I’ve attempted to schedule it using the task scheduler and set everything I can think off

    The SCHED.LOG file reports that it started, and then that it has completed with the following messages
    “Backup.job” (Backuplog.bat)
    Started 2/06/2003 8:26:23 a.m.
    “Backup.job” (Backuplog.bat)
    Finished 2/06/2003 8:26:23 a.m.
    Result: The task completed with an exit code of (80).

    Sadly, there is no evidence that the job has run – my first line is an “ECHO started on DATE > F:BackupJunk.txt” which does not appear.

    What am I doing wrong? Or, alternatively, where is there a good source of documentation.
    Info that may or may not be relevant
    I have set a valid user account with password,
    I have set a start directory “F:Backup”
    I have quoted the batch file as a fully qualified name “F:BackupBackuplog.bat”
    I have preceded it with “cmd /Q /C ” on occasions with no better results

    Viewing 1 reply thread
    Author
    Replies
    • #681558

      Try including an output file for the batch commands in the scheduler command. as in this screen shot. Then then look in the log file.

      StuartR

      • #681669

        Stuart,
        When I try to use my Scheduled Task program and I enter all the proper info PWs, my account and what task I get an error message that states Object Already Exist 0x800900F Then when I click on ok I get another message that states General Page Initializtion Failed program may not run. Do you have any idea what in the world is going on with my Scheduled Task program? I’ve just been ignoring it and running all my stuff manually. On another note and maybe this will help give you more info….. when you do the cleanmgr /sageset to set the files you want cleanup mgr. to clean on your disk it won’t show me ALL the files when it list the default window for the C: drive. However if I type cleanmgr /sageset:99 or some number at the end that doesn’t indicate the C: drive it does show me all the files. Any ideas what is going on here? Like I said this has been so frustrating I’ve just been ignoring it and cleaning my disk manaully as well as doing my Task manaully.

        I’d really appreaciate any input from anybody if anybody’s ever heard of such craziness. I hope I’m not upsetting anyone with all my beginner type questions, but when things don’t follow the common sense base line I get lost really quick. Thank you or anyone else that can point me in the right direction.

        Regards,
        JeffT

        • #681782

          Jeff,

          Sorry, I haven’t come across either of these before.

          You may get more responses if you post your question as a completely new thread, with a relevant title, rather than as a response to this one.

          StuartR

          I just remembered
          I have seen a very similar problem with Task Manager when a computer had some jobs scheduled to run under a Domain account and was then removed from the domain to become a standalone PC in a workgroup.

          StuartR

    • #681614

      Andrew, Scheduled tasks require a user and password. The password can not be blank. Did you do that?

      Joe

      --Joe

      • #681618

        Stuart & Joe – thanks for your time and suggestions.

        I think I’m on the track now – although perhaps someone can read this and shed some more light.

        My own account has NO password. I therefore created an account called “Backup” that had one and scheduled the jobs with that particular usercode.

        The result is – if I am logged on as Backup when I try to run the job it runs fine. If I am logged on as me – it fails silently (no output even from Stuart’s suggestion).
        It also wants to display things (like the command window and NTBackup output) on the screen.

        Naturally, this is not quite what I had hoped for. My workaround is to give my own account a password, use that account as the batch job’s user, and simply put up with the unwanted screen display – at least backups will happen grin

        • #681631

          (Edited by TimOz on 03-Jun-03 14:42. I stuffed up!)

          This is mostly untrrue woops see post 260501 and post 260582 for the real thing.

          The user has to be logged on for their scheduled jobs to run. The “silent fail” is just a non-event because the scheduler for Backup isn’t running when the user isn’t logged on. It would be nice if windows had a real batch or job environment, so jobs could be run independently of the user. Unfortunately you need a more industrial strength OS to do so.

          There is a way around it, though. First, enable fast user switching (Control Panel | User Accounts | Change the way users log on or off). Then you can log on as Backup, so the job will run, and switch back to your real self to do other work. Your unwanted screen displays won’t show until you switch back to Backup. But be aware that files you have in use won’t be backed up. It’s also probably a good idea to make Backup an administrator so it can backup anyone’s files.

          • #681637

            Tim

            That clears it all up thankyou – I’ll just run it as me and live with it grin

            I appreciate the time and expertise from everybody – its great to get help when all other avenues have closed.

          • #681868

            Tim, According to Xp’s Help & Support the user does not have to be logged in. The run will still run. There is a batch type queue that each user automatically is allowed. This can be modified by a security policy. If you do a search on ‘scheduled tasks’ in Help & Support you’ll get a lot of reading material.

            Joe

            --Joe

            • #681962

              blush woops Thanks Joe – at least when I stuff up, it’s educational! grin This one goes in the “learn something new every day” category. Sorry for the misinformation earlier sorry I would have replied sooner, but had to read & play first to give myself a chance of getting it at least half right this time.

              Yes, tasks will run, even when you’re not logged on. Screen displays won’t show (of course) but, as long as user input is not needed, the task will run fine. I’m on home, so no access to policies to change the default settings, but it all seems to work. The “Wake the computer to run this task” option looks handy, but I havent tried it out yet.

              The log is a useful check, but initially looked like it wasn’t working because neither entries at start nor end were changing. Then scrolling through it I chanced on the line “[ ***** Most recent entry is above this line ***** ]” (no idea why it updates in the middle of the log?). Normally the start, finish and exit code are logged. If the task starts via a shortcut only the start is logged.

              An administrator can schedule tasks on behalf of any user. A normal user can only schedule their own tasks. Administrators can also use the “at” command to run tasks under the “AT service” account. That too was a new one for me, and good to know about.

              The problem now is I have no idea why Andrew’s backup task didn’t work? It should have at least shown up in the log.

    Viewing 1 reply thread
    Reply To: Scheduling a .BAT script has me confused (XP Home)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: