Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Unable to start scheduled task after creating it with Schtasks

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-03-2008
Flea#
 
Posts: n/a
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/

Reply With Quote
  #2  
Old 07-03-2008
Ryan Newington
 
Posts: n/a
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/

Reply With Quote
  #3  
Old 07-03-2008
Ryan Newington
 
Posts: n/a
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/

Reply With Quote
  #4  
Old 07-03-2008
Dave Patrick
 
Posts: n/a
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/


Reply With Quote
  #5  
Old 07-03-2008
Ryan Newington
 
Posts: n/a
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/

>

Reply With Quote
  #6  
Old 08-03-2008
Flea#
 
Posts: n/a
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/

Reply With Quote
  #7  
Old 08-03-2008
Flea#
 
Posts: n/a
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/

Reply With Quote
  #8  
Old 09-03-2008
Dave Patrick
 
Posts: n/a
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


Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unable to start scheduled task after creating it with Schtasks"
Thread Thread Starter Forum Replies Last Post
Windows Scheduled Task: Unable to start task. 0x80070005: Access is denied. BCU_AJones Windows Software 3 17-01-2014 10:37 AM
Scheduled Task does not run coreymac1222 Windows XP Support 3 06-03-2009 02:06 AM
scheduled printing of a text file using batch files or schtasks Gadgetman Windows XP Support 10 12-06-2008 11:48 PM
Scheduled Task - Can Not Start Matt Colegrove Windows Server Help 3 08-06-2007 10:29 AM
Scheduled Task error code:The task completed with an exit code of Teo Chee Yang Windows Server Help 7 26-02-2007 06:01 PM


All times are GMT +5.5. The time now is 04:46 PM.