The package is executed manually, but not in the scheduled task.

I don't write batches at all, but currently I have a batch that uses forfiles to copy my FLV from one folder to another. When I run the package manually, it works every time, but from the scheduled task it throws an error (0x1) .

 forfiles -p "C:\Program Files\Adobe\Flash Media Server 4.5\applications\name\streams" -m *.flv -s -d -1 -c "cmd /c copy @file ^0x22C:\Program^ Files\Adobe\Flash^ Media^ Server^ 4.5\applications\name\output\" 

I don’t know which syntax of the scheduled task you do not like.

Update

As part of my planned task, I have the following actions:

 Program/script: name.bat Start in (optional): \\servername\file\to\batch 
+4
source share
7 answers

When my Start in (optional): path was a UNC loop, it didn't work. So I moved my batch to the server, and everything worked correctly.

UNC in Windows batch files

files with UNC paths

+3
source

See screenshot below. You need to change the user to the system enter image description here

+2
source

Hi, maybe this is useful, I also come across the same question. Just set the starting path as follows:

enter image description here

Here, the beginning of the path is the path to the batch file: as you entered the script program: "E: \ files associated with the program \ demo.bat", then simply go to startin: E: \ files and files made with the program!

thanks

Arun Sharma

+2
source

The most common cause of such problems is resolution: scheduled tasks are NOT always performed with your user credentials . If you want the scheduled task to run as you do , you need to configure it as you or an alternate user.

In addition, I hope that your line of code is the content of your batch file, you are not trying to run this command directly. Or you?

PS What is this ^0x22 and ^ in your code?

0
source

I know this is an old question, but just wanted to share some information.

Error code (0x01) can also refer to resources that are not found. Therefore:

  • all files / folders transferred from the batch file must be accessible to the user for whom this account is used to perform the scheduled task;
  • pay attention when using network locations in combination with the option "Run regardless of whether the user is turned on";
  • The above option may be difficult to use, since some resources may not be available until after logging in.
0
source

In Server 2008 R2, when I run a batch file under the security credentials of a user of a domain with security confirmation “log in as a batch job” in the local security policy> “Local settings”> “Assign user rights”, even then my batch (copying the log file to the general network share) will not run as a scheduled task until I choose the tab "General" option "Run with highest privileges" (not selected by default!) also, the option "Start" has been selected, whether the user is on or It is, with the "radio" button, but I think this is pretty standard when you select to run the task by using a domain user account.

For the “Actions” tab: specifying the entire name of the batch file, including its path, directly in “Program / script:” works fine (with Server 2008 R2) Using double quotes inside the batch file does not cause problems.

0
source

For .bat files to run inside a scheduled task, you need to specify the path to the .bat file in the start parameter - despite the fact that your .bat file is in the same directory as your .exe. In addition, I noted that he works with the highest privileges. After I completed these two tasks, the task will suddenly exit without problems!

Windows schedule graphic

0
source

Source: https://habr.com/ru/post/1435272/


All Articles