Schtasks called from batch not recognized

I have a batchfile that ftp's several other batch files to a computer, then calls one of them which schedules the rest. The scheduler batch file uses the schtasks command. When i run the first batch file, it pulls the files fine but twhen it calls the scheduler, i get the error "'schtasks' is not recognized as an internal or external command, operable program or batch file." However I know that the command is installed on the computer because i can type in 'schtasks' and i get all the current scheduled tasks' information. I can also manually run the second scheduler batch file and it runs. It only fails when the first batch file calls it. The calling statement at the very end of the first batch file is "call C:\batchfiles\scheduler.bat". The scheduler is only four schtasks commands on four lines. Can you help me figure out why the commands fail when called from the first batch file.
8 answers Last reply Best Answer
More about schtasks called batch recognized
  1. Try putting the full path to the schtasks command in the batch file, or are you already doing that?
  2. i thought that the schtasks command location was in the $PATH variable. plus i tried running the schtasks in command prompt from several different directories. it worked still. i also tried putting several different cd commands before both my call statment and before the schtasks commands in either batch file. it still failed.
  3. Best answer
    That error can really only come up form a few things. If the program does not exist, if it's typed wrong, or if the computer can't find it.

    Since it works when you run it manually, the program is there. So something is happening when you are running it from the original batch file so it can't find the command. If you put in the full path to it in the second batch file, that should fix it. Make sure you use quotes if the program path has spaces or the short directory names.

    Or make the schtasks command part of the first batch file, see if that runs OK.
  4. but to better answer your question: no i dont have the full path to schtasks in the batch file. i just say " schtasks ...." for each of my statements.
  5. so i tried removing the call statement and putting the schtasks commands in the main file. it still fails with the same error.
  6. i should clarify. the move from the ftp works fine, but the scheduling fails due to the schtasks error
  7. SOLVED: so i got it working. i played off the advice you gave me about putting the entire filename in the schtasks call. i put a cd to system32 right before all the schtasks calls with the schtasks in the main file. now it works. Thank you for your help.
  8. Best answer selected by btl@entrada.
Ask a new question

Read More

Computers Command Prompt Windows 7