Results 1 to 8 of 8

Thread: Unable to start scheduled task after creating it with Schtasks

  1. #1
    Flea# Guest

    Unable to start scheduled task after creating it with Schtasks

    Hello,

    I'm using Schtasks to create a scheduled task on a remote server using the
    SYSTEM account to run it. After I create the scheduled task, remote into the
    server, I try and run it and it comes back with status of "Could not start".

    When I view the log, it says "The system cannot find the file specified.".
    The really frustrating problem is I can open the scheduled task, copy the
    path and paste it into the run command and it will launch my executable. So
    the path IS correct! If I delete the task and create it manually, browsing to
    the same executable, it will run just fine! So it seems to be something with
    creating it with Schtasks. Here is my command line: Schtasks /create /sc
    DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    deviisvm01 /ru System /st 01:00:00

    Any help would be appreciated it.

    --
    http://fleasharp.blogspot.com/

  2. #2
    Ryan Newington Guest

    RE: Unable to start scheduled task after creating it with Schtasks

    Hi,

    Using C:\Progra~1\SF\AMF\AMFCollector.exe works.

    For some reason, it is thinking "C:\Program" is the command, and is passing
    "Files\SF\AMF\AMFCollector.exe" as an argument.

    Ryan

    "Flea#" wrote:

    > Hello,
    >
    > I'm using Schtasks to create a scheduled task on a remote server using the
    > SYSTEM account to run it. After I create the scheduled task, remote into the
    > server, I try and run it and it comes back with status of "Could not start".
    >
    > When I view the log, it says "The system cannot find the file specified.".
    > The really frustrating problem is I can open the scheduled task, copy the
    > path and paste it into the run command and it will launch my executable. So
    > the path IS correct! If I delete the task and create it manually, browsing to
    > the same executable, it will run just fine! So it seems to be something with
    > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > deviisvm01 /ru System /st 01:00:00
    >
    > Any help would be appreciated it.
    >
    > --
    > http://fleasharp.blogspot.com/


  3. #3
    Ryan Newington Guest

    RE: Unable to start scheduled task after creating it with Schtasks

    Actually, just read this in the schtaks help

    ---------------------------------
    Spaces in file paths can be used by using two sets of quotes, one
    set for CMD.EXE and one for SchTasks.exe. The outer quotes for CMD
    need to be double quotes; the inner quotes can be single quotes or
    escaped double quotes:
    SCHTASKS /Create
    /tr "'c:\program files\internet explorer\iexplorer.exe'
    \"c:\log data\today.xml\"" ...
    ---------------------------------

    So the correct command line syntax is

    Schtasks /create /sc DAILY /tn AMFCollector /tr "'C:\Program
    Files\SF\AMF\AMFCollector.exe'" /s deviisvm01 /ru System /st 01:00:00

    Ryan


    "Flea#" wrote:

    > Hello,
    >
    > I'm using Schtasks to create a scheduled task on a remote server using the
    > SYSTEM account to run it. After I create the scheduled task, remote into the
    > server, I try and run it and it comes back with status of "Could not start".
    >
    > When I view the log, it says "The system cannot find the file specified.".
    > The really frustrating problem is I can open the scheduled task, copy the
    > path and paste it into the run command and it will launch my executable. So
    > the path IS correct! If I delete the task and create it manually, browsing to
    > the same executable, it will run just fine! So it seems to be something with
    > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > deviisvm01 /ru System /st 01:00:00
    >
    > Any help would be appreciated it.
    >
    > --
    > http://fleasharp.blogspot.com/


  4. #4
    Dave Patrick Guest

    Re: Unable to start scheduled task after creating it with Schtasks

    You should be using the AT command line scheduler for system account tasks.


    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "Flea#" wrote:
    > Hello,
    >
    > I'm using Schtasks to create a scheduled task on a remote server using the
    > SYSTEM account to run it. After I create the scheduled task, remote into
    > the
    > server, I try and run it and it comes back with status of "Could not
    > start".
    >
    > When I view the log, it says "The system cannot find the file specified.".
    > The really frustrating problem is I can open the scheduled task, copy the
    > path and paste it into the run command and it will launch my executable.
    > So
    > the path IS correct! If I delete the task and create it manually, browsing
    > to
    > the same executable, it will run just fine! So it seems to be something
    > with
    > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > deviisvm01 /ru System /st 01:00:00
    >
    > Any help would be appreciated it.
    >
    > --
    > http://fleasharp.blogspot.com/



  5. #5
    Ryan Newington Guest

    Re: Unable to start scheduled task after creating it with Schtasks

    Hi Dave,

    From
    http://technet2.microsoft.com/window....mspx?mfr=true

    Schtasks replaces At.exe, a tool included in previous versions of Windows.
    Although At.exe is still included in the Windows Server 2003 family, schtasks
    is the recommended command-line task scheduling tool.

    Ryan



    "Dave Patrick" wrote:

    > You should be using the AT command line scheduler for system account tasks.
    >
    >
    > --
    >
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "Flea#" wrote:
    > > Hello,
    > >
    > > I'm using Schtasks to create a scheduled task on a remote server using the
    > > SYSTEM account to run it. After I create the scheduled task, remote into
    > > the
    > > server, I try and run it and it comes back with status of "Could not
    > > start".
    > >
    > > When I view the log, it says "The system cannot find the file specified.".
    > > The really frustrating problem is I can open the scheduled task, copy the
    > > path and paste it into the run command and it will launch my executable.
    > > So
    > > the path IS correct! If I delete the task and create it manually, browsing
    > > to
    > > the same executable, it will run just fine! So it seems to be something
    > > with
    > > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > > deviisvm01 /ru System /st 01:00:00
    > >
    > > Any help would be appreciated it.
    > >
    > > --
    > > http://fleasharp.blogspot.com/

    >


  6. #6
    Flea# Guest

    RE: Unable to start scheduled task after creating it with Schtasks

    Hey Ryan,

    Thanks for your reply, I really thought that might fix it up but after
    running that, I still received the same error "Could not start" The system
    cannot find the file specified.

    I did notice one thing though. After I automatically create that task, I
    notice the field for "Start in:" is blank, where as, when I manually create
    the task, the "Start In" field has the path in there. On the task that is
    not working, I tried putting in the path, but it still failed, but I did find
    it interesting to why the start in path was not there when I used Schtask but
    it was there when I manually did it.

    -Flea#

    --
    http://fleasharp.blogspot.com/


    "Ryan Newington" wrote:

    > Actually, just read this in the schtaks help
    >
    > ---------------------------------
    > Spaces in file paths can be used by using two sets of quotes, one
    > set for CMD.EXE and one for SchTasks.exe. The outer quotes for CMD
    > need to be double quotes; the inner quotes can be single quotes or
    > escaped double quotes:
    > SCHTASKS /Create
    > /tr "'c:\program files\internet explorer\iexplorer.exe'
    > \"c:\log data\today.xml\"" ...
    > ---------------------------------
    >
    > So the correct command line syntax is
    >
    > Schtasks /create /sc DAILY /tn AMFCollector /tr "'C:\Program
    > Files\SF\AMF\AMFCollector.exe'" /s deviisvm01 /ru System /st 01:00:00
    >
    > Ryan
    >
    >
    > "Flea#" wrote:
    >
    > > Hello,
    > >
    > > I'm using Schtasks to create a scheduled task on a remote server using the
    > > SYSTEM account to run it. After I create the scheduled task, remote into the
    > > server, I try and run it and it comes back with status of "Could not start".
    > >
    > > When I view the log, it says "The system cannot find the file specified.".
    > > The really frustrating problem is I can open the scheduled task, copy the
    > > path and paste it into the run command and it will launch my executable. So
    > > the path IS correct! If I delete the task and create it manually, browsing to
    > > the same executable, it will run just fine! So it seems to be something with
    > > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > > deviisvm01 /ru System /st 01:00:00
    > >
    > > Any help would be appreciated it.
    > >
    > > --
    > > http://fleasharp.blogspot.com/


  7. #7
    Flea# Guest

    RE: Unable to start scheduled task after creating it with Schtasks

    I actually found the solution thanks to another forum
    (http://www.eggheadcafe.com/software/...run-prog.aspx).
    Turns out the problem was the quotes were being stripped off the file path in
    the 'Run" field. No big deal, just need to escape the quotes out, well, not
    once, twice, or three times but four times later, the quotes will finally
    show up and then the task will run.

    I am using powershell to run this, so I had to escape the quotes out with
    its specific escape character but it looks like this:

    "`"`"`"`"C:\Program Files\SF\AMF\AMFCollector.exe'`"`"`"`""



    --
    http://fleasharp.blogspot.com/


    "Flea#" wrote:

    > Hey Ryan,
    >
    > Thanks for your reply, I really thought that might fix it up but after
    > running that, I still received the same error "Could not start" The system
    > cannot find the file specified.
    >
    > I did notice one thing though. After I automatically create that task, I
    > notice the field for "Start in:" is blank, where as, when I manually create
    > the task, the "Start In" field has the path in there. On the task that is
    > not working, I tried putting in the path, but it still failed, but I did find
    > it interesting to why the start in path was not there when I used Schtask but
    > it was there when I manually did it.
    >
    > -Flea#
    >
    > --
    > http://fleasharp.blogspot.com/
    >
    >
    > "Ryan Newington" wrote:
    >
    > > Actually, just read this in the schtaks help
    > >
    > > ---------------------------------
    > > Spaces in file paths can be used by using two sets of quotes, one
    > > set for CMD.EXE and one for SchTasks.exe. The outer quotes for CMD
    > > need to be double quotes; the inner quotes can be single quotes or
    > > escaped double quotes:
    > > SCHTASKS /Create
    > > /tr "'c:\program files\internet explorer\iexplorer.exe'
    > > \"c:\log data\today.xml\"" ...
    > > ---------------------------------
    > >
    > > So the correct command line syntax is
    > >
    > > Schtasks /create /sc DAILY /tn AMFCollector /tr "'C:\Program
    > > Files\SF\AMF\AMFCollector.exe'" /s deviisvm01 /ru System /st 01:00:00
    > >
    > > Ryan
    > >
    > >
    > > "Flea#" wrote:
    > >
    > > > Hello,
    > > >
    > > > I'm using Schtasks to create a scheduled task on a remote server using the
    > > > SYSTEM account to run it. After I create the scheduled task, remote into the
    > > > server, I try and run it and it comes back with status of "Could not start".
    > > >
    > > > When I view the log, it says "The system cannot find the file specified.".
    > > > The really frustrating problem is I can open the scheduled task, copy the
    > > > path and paste it into the run command and it will launch my executable. So
    > > > the path IS correct! If I delete the task and create it manually, browsing to
    > > > the same executable, it will run just fine! So it seems to be something with
    > > > creating it with Schtasks. Here is my command line: Schtasks /create /sc
    > > > DAILY /tn AMFCollector /tr "C:\Program Files\SF\AMF\AMFCollector.exe" /s
    > > > deviisvm01 /ru System /st 01:00:00
    > > >
    > > > Any help would be appreciated it.
    > > >
    > > > --
    > > > http://fleasharp.blogspot.com/


  8. #8
    Dave Patrick Guest

    Re: Unable to start scheduled task after creating it with Schtasks

    Ok, thanks for letting us know.

    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "Ryan Newington" wrote:
    > Hi Dave,
    >
    > From
    > http://technet2.microsoft.com/window....mspx?mfr=true
    >
    > Schtasks replaces At.exe, a tool included in previous versions of Windows.
    > Although At.exe is still included in the Windows Server 2003 family,
    > schtasks
    > is the recommended command-line task scheduling tool.
    >
    > Ryan



Similar Threads

  1. Replies: 3
    Last Post: 17-01-2014, 10:37 AM
  2. Scheduled Task does not run
    By coreymac1222 in forum Windows XP Support
    Replies: 3
    Last Post: 06-03-2009, 02:06 AM
  3. scheduled printing of a text file using batch files or schtasks
    By Gadgetman in forum Windows XP Support
    Replies: 10
    Last Post: 12-06-2008, 11:48 PM
  4. Scheduled Task - Can Not Start
    By Matt Colegrove in forum Windows Server Help
    Replies: 3
    Last Post: 08-06-2007, 10:29 AM
  5. Scheduled Task error code:The task completed with an exit code of
    By Teo Chee Yang in forum Windows Server Help
    Replies: 7
    Last Post: 26-02-2007, 06:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,656,394,237.56386 seconds with 16 queries