none
Running batch files with Task Scheduler in Vista

    Question

  • Hello,

     

    I have a batch file that starts a bunch of programs on a local machine. I need to interact with those programs, so they have to be visible on screen. Since I want these programs to start while I'm not usually in front of my computer, I use Task Scheduler to wake up the computer and run the batch file. This has worked flawlessly on XP.

     

    However, on Vista, I never see the programs. If I run the batch file from the command prompt, everything works out great. However, if Task Scheduler runs the batch file, then none of the programs (including the command prompt window that executes the batch file) ever show up on screen. Most of the programs do seem to run (as can be seen in task manager), but I can't see them on screen. There are a few programs (all using Java) that don't run. If I could see the command prompt on screen that would make it easier to diagnose.

     

    Anyway, yes the task is set to run with highest privilege (not that it should matter, since I can run the batch file manually without requiring administrator privileges), the startup directory is set the same as if I was starting the batch file manually, and the user account used to run the task is the same as the account that I'm logged in as, the 'hidden' option is unchecked.

     

    As a sanity check, I just created a task that runs Word, with all the same options as above. It, also, shows up hidden. I don't know if this confirms my sanity or my insanity. I can't possibly be the first to run into this?

     

    So, how do I get these scheduled tasks to show up on screen in Vista?

     

    Thanks!

     

    Tuesday, August 07, 2007 2:53 AM

Answers

  • Turns out not to be too much of an issue after all. This my own machine, so I just get to hibernate or sleep with my account logged in, and when Task Scheduler wakes up the machine I'm already logged on, so it works similar to on XP.

    I still find it awkward that the tasks don't become interactive when the right user logs on, but oh well.

     

    Tuesday, August 14, 2007 4:42 AM

All replies

  • This is the exported task for my little word test. As you can see, the hidden property is false... and I'm logged in with the same account as the Author.

     

    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2007-08-06T22:50:06.863</Date>
        <Author>Jimmy-PC\Jimmy</Author>
      </RegistrationInfo>
      <Triggers />
      <Principals>
        <Principal id="Author">
          <UserId>Jimmy-PC\Jimmy</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>LeastPrivilege</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <IdleSettings>
          <Duration>PT10M</Duration>
          <WaitTimeout>PT1H</WaitTimeout>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>"C:\Program Files (x86)\Apps\Microsoft Office\Office12\WINWORD.EXE"</Command>
        </Exec>
      </Actions>
    </Task>

     

    Wednesday, August 08, 2007 1:48 AM
  • Oh, I found out that the issue was "Run whether user is logged on or not". If that's enabled, even if the user *is* logged on, then the task won't show up.

     

    This really sucks. In my scenario, I was having task scheduler wake up the computer, even when I'm not at home, and run the task. Now it seems that I can't do that (and have the programs be interactive when I *do* log in) with Vista?

    Wednesday, August 08, 2007 2:20 AM
  • Turns out not to be too much of an issue after all. This my own machine, so I just get to hibernate or sleep with my account logged in, and when Task Scheduler wakes up the machine I'm already logged on, so it works similar to on XP.

    I still find it awkward that the tasks don't become interactive when the right user logs on, but oh well.

     

    Tuesday, August 14, 2007 4:42 AM