0xc000013a ошибка планировщик

I’m using Windows Server 2003 and have a scheduled task that fails to complete. The task is set to run a Windows Command Script (.cmd) at 3pm each day. The script runs a program that extracts some data from a SQL Server database and uploads that data to an FTP server.

The error code displayed in the «Last result» column of the scheduled tasks folder is 0xc000013a. A quick Google search leads to this Microsoft support page that states: The most common «C» error code is «0xC000013A: The application terminated as a result of a CTRL+C».

No-one is logged in at the time the task runs, so there’s no-one around to press CTRL+C. I’m not sure I understand what is being said here in the Microsoft documentation.

I’ve checked the rudimentary things — the scheduled task is enabled, scheduled to run each day, and pointing to a file that does exist in a valid location. Interestingly, when I run this task manually (either by running the .cmd script from the command line, or by right-clicking the task and clicking «Run») the task completes successfully.

What does this error code mean, and how can I get this task to run when I’m not there to force it?

asked May 13, 2009 at 4:08

Brian Willis's user avatar

Brian WillisBrian Willis

3,6394 gold badges21 silver badges14 bronze badges

1

Troubleshooting scheduled scripts:

  1. If you haven’t already, check the Scheduled Tasks log file, in the GUI under Advanced > View Log. Search the file for «***» to find the most recent entries, and you may see a little extra error info.

  2. Define a log file to capture output, and send both standard out and standard error there. Change any echo OFF to echo ON to be sure you’re not supressing any error messages.
    For example, if your script is called ftp.data.cmd then your scheduled task might look like this,

    cmd /c ftp.data.cmd >> ftp.data.log 2>&1

  3. Is the script hanging? Maybe the task scheduler is killing the script (hence the CTRL+C error code) after some specified period of time. Add some of these at strategic points in your scipt,

    echo %DATE% %TIME%

  4. Are you sure the account running the script has permissions / access to everything in the script?

  5. If you can’t get any joy, run this command and post the output here, maybe we can start with the scheduling,

    schtasks /query /v /fo LIST /s YOURSERVER

answered Jun 16, 2009 at 14:55

nray's user avatar

I can’t answer the question directly as I don’t know specifically what the error message means (nor, therefore, how to fix it), but if I were trying to troubleshoot it I would add a few writes to a log file at strategic points in the script and then after the scheduled time see what the last checkpoint to run is.

My suspicion would be that there’s something that’s failing due to the credentials the script is running under or something in the script needs a logged-in user. Narrowing down where in the script things fail might help you find the «offending» code.

answered May 13, 2009 at 5:02

cori's user avatar

coricori

3811 gold badge8 silver badges16 bronze badges

I realize this is an old posting but they’re very helpful when searching for solutions and maybe what I found can be helpful too. I was using WinSCP on Windows Server 2003 to upload to an ftp server and received the same error message and the SchedLgU.txt file pointed to not enough time in the «Stop the task if it furn for:» section even though I gave the task plenty of time to upload.

Looking in Task Manager I could see that WinSCP.exe wasn’t clearing out and I had tons of the processes in the list, so I created a batch file (taskkill /f /im winscp.exe) to kill any opened process and I have that batch file run before the WinSCP and it works well now.

answered Feb 2, 2011 at 22:08

susand's user avatar

I ran into this today on a remote server, and the solution was to change the run setting from «Run only when the user is logged on» to «Run whether the user is logged in or not».

With «Run only when the user is logged on» the task launches a command window that was closed when my remote desktop session timed out. With «Run whether the user is logged in or not» no window is displayed while the task runs, so the execution does not stop when my remote desktop session ends.

answered Mar 6, 2018 at 16:23

VolleyJosh's user avatar

Similar to cori’s answer I would recommend that you check who the scheduled task is set to run as, as I have seen this error occur when the user account that is running the task doesn’t have the same permissions as the logged in user

answered May 13, 2009 at 5:07

Glenn Slaven's user avatar

Glenn SlavenGlenn Slaven

2,4002 gold badges30 silver badges42 bronze badges

If this ran before, perhaps a condition like a network outage or a problem on another host can explain the failure.

answered Aug 2, 2011 at 3:27

Ted Taylor's user avatar

I had the same error and it was because the batch file I was running was prompting for some files to delete with DEL command. As there is no user to answer Y/N to batch process the scheduled task is terminated.
The following is the message I have found on my scheduled tasks log:
«the task was terminated. This action was initiated either by an administrator or by the Task Scheduler service (because, for example, the computer is now non idle).»
My recommendation is to run the task manually from the command prompt to see where it is stopping or prompting for some user interaction, correct it and your task will run fine.

answered Jun 19, 2013 at 14:23

ruddwall's user avatar

If you are trying to run the program under Task Scheduler control, the System.Environment.CurrentDirectory will return C:\Windows\System32, NOT where your executable is located. This error can be a file-not-found error; I was trying to log to a subdirectory and it didn’t exist in the System32 tree.

answered May 27, 2014 at 18:29

roadkill42's user avatar

At my scripts this is clear.
It happen’s cause i have «pause» at the end of batch file and scheduled task is limited to 20 minutes. When user is present, hi can see flow of the job. When isn’t batch file is terminated by scheduled task, after 20 min. This is causing 0xc000013a and it’s ok.

answered Aug 12, 2011 at 5:23

Danko's user avatar

I had the same issue and fixed it by changing the trigger from «On system startup» to «On logon».

answered Feb 6, 2014 at 20:55

Andrei G's user avatar

had the same problem..
fixed by playing with user who is registered to run the scheduled task.
in the end, changing the domain was the answer.

answered Jun 10, 2014 at 5:53

tal's user avatar

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

Сообщение с кодом ошибки 0xc000013a возникает при выполнении скриптов, которые обрабатывают цифровые и текстовые массивы данных. В описании проблемы указывается, что она вызвана:

  • нажатием сочетания клавиш Ctrl+C;
  • принудительным закрытием Командной строки;
  • выходом пользователя из системы.

Для устранения ошибки предпринимайте следующие меры:

  1. Убедитесь, что планировщик задач не останавливает процесс после определенного отрезка времени. Для этого в ключевых местах скрипта стоить добавить строку echo %DATE% %TIME%;
  2. Проверьте, что у аккаунта, под которым выполняется скрипт, есть все необходимые права.
  3. Исследуйте лог Планировщика заданий. Ищите в хронологически последних строках значения *** — в них будут указаны детали ошибки, которые прольют свет на природу проблемы.
  4. Создайте лог для регистрации результатов выполнения скрипта. В самом коде измените все echo OFF на echo ON, чтобы проверить, что вы не прекращаете выполнение скрипта случайным образом, не замечая этого, ведь ошибка 0xc000013a чаще всего вызывается именно так.

Содержание

  • АННОТАЦИЯ

    • Проверка состояния задачи

    • Проверка журнала назначенных заданий

    • Проверка службы планировщика заданий

Аннотация

В статье приводится пошаговое описание устранений неполадок, связанных с назначенными заданиями в Windows XP и Windows Server 2003. Если назначенные задания не запускаются, для поиска источника проблем можно применить ряд способов.

Примечание. Администраторы и пользователи с полномочиями администраторов могут настроить планировщик заданий на отправку уведомления, если назначенное задание не запустилось так, как было запланировано. Для этого щелкните Уведомлять о пропущенных заданиях в меню Дополнительно.

Проверка состояния задачи

Периодически проверяйте состояние назначенных заданий, поскольку иногда можно не заметить, что назначенное задание не запускается. С помощью пункта «Подробно» окна назначенных заданий просмотрите следующие сведения о каждом задании:

  • Расписание — Расписание запуска задания.

  • Время следующего запуска — время и дата следующего запуска задания.

  • Время прошлого запуска — время и дата предыдущего запуска задания.

  • Состояние — Текущее состояние задания.

  • Прошлый результат — Код выполнения последнего запуска.

Столбец Состояние содержит следующие сведения о состоянии и описание:

  • Пусто — Задание не запущено или было запущено и выполнено успешно.

  • Работает — Задание запущено.

  • Пропущено — Пропущена одна или несколько попыток запустить задание.

  • Запуск не удался — Предыдущая попытка запустить задание не удалась.

Столбец Прошлый результат показывает код выполнения. Полное описание всех кодов завершения Windows можно найти в MSDN, но обычные коды для назначенных заданий следующие:

  • 0x0: Операция выполнена успешно.

  • 0x1: Вызов неверной или неизвестной функции.

  • 0xa: Ошибка в среде.

Если формат кода завершения «C0000XXX», задание не было успешно завершено («C» указывает на ошибку). Наиболее распространенный код завершения с «C» — «0xC000013A: Приложение завершено из-за нажатия сочетания клавиш CTRL+C».

Также проверьте следующие данные в свойствах задания:

  • Убедитесь, что установлен флажок, включающий выполнение задания.

  • Проверьте правильность пути к программе. Кроме того, проверьте, не требует ли программа для запуска каких-либо отсутствующих параметров командной строки.

Проверка журнала назначенных заданий

Назначенные задания фиксируются в файле журнала (Schedlgu.txt) в папке c:\Windows. Журнал можно просмотреть из окна назначенных заданий, выбрав Просмотр журнала в меню Дополнительно.

Размер файла журнала 32 килобайта (КБ), после достижения максимального размера автоматически начинается запись с начала журнала поверх старых данных.

Проверка службы планировщика заданий

Для запуска заданий служба планировщика заданий должна быть запущена и правильно настроена. При остановке назначенных заданий вручную из окна назначенных заданий служба останавливается и не включается автоматически при следующем запуске компьютера. Если служба не настроена на запуск с использованием локальной системной учетной записи, она может не запуститься.

Проверка параметров службы:

  1. В меню Пуск выберите пункт Панель управления, а затем Администрирование.

  2. Щелкните значок Управление компьютером.

  3. Разверните узел Службы и приложения и выберите элемент Службы.

  4. Правой кнопкой мыши щелкните службу Планировщик заданий и выберите пункт Свойства.

  5. На вкладке Общие проверьте, что тип запуска выбран как авто, и состояние службы — запущена. Если служба не запущена, нажмите Пуск.

  6. На вкладке Вход в систему проверьте, что выбран пункт «С системной учетной записью» и установлен флажок Разрешить взаимодействие с рабочим столом.

  7. Нажмите кнопку OK и закройте окно управления компьютером.

Нужна дополнительная помощь?

Нужны дополнительные параметры?

Изучите преимущества подписки, просмотрите учебные курсы, узнайте, как защитить свое устройство и т. д.

В сообществах можно задавать вопросы и отвечать на них, отправлять отзывы и консультироваться с экспертами разных профилей.

I’m using Windows Server 2003 and have a scheduled task that fails to complete. The task is set to run a Windows Command Script (.cmd) at 3pm each day. The script runs a program that extracts some data from a SQL Server database and uploads that data to an FTP server.

The error code displayed in the «Last result» column of the scheduled tasks folder is 0xc000013a. A quick Google search leads to this Microsoft support page that states: The most common «C» error code is «0xC000013A: The application terminated as a result of a CTRL+C».

No-one is logged in at the time the task runs, so there’s no-one around to press CTRL+C. I’m not sure I understand what is being said here in the Microsoft documentation.

I’ve checked the rudimentary things — the scheduled task is enabled, scheduled to run each day, and pointing to a file that does exist in a valid location. Interestingly, when I run this task manually (either by running the .cmd script from the command line, or by right-clicking the task and clicking «Run») the task completes successfully.

What does this error code mean, and how can I get this task to run when I’m not there to force it?

asked May 13, 2009 at 4:08

Brian Willis's user avatar

Brian WillisBrian Willis

3,6394 gold badges21 silver badges14 bronze badges

1

Troubleshooting scheduled scripts:

  1. If you haven’t already, check the Scheduled Tasks log file, in the GUI under Advanced > View Log. Search the file for «***» to find the most recent entries, and you may see a little extra error info.

  2. Define a log file to capture output, and send both standard out and standard error there. Change any echo OFF to echo ON to be sure you’re not supressing any error messages.
    For example, if your script is called ftp.data.cmd then your scheduled task might look like this,

    cmd /c ftp.data.cmd >> ftp.data.log 2>&1

  3. Is the script hanging? Maybe the task scheduler is killing the script (hence the CTRL+C error code) after some specified period of time. Add some of these at strategic points in your scipt,

    echo %DATE% %TIME%

  4. Are you sure the account running the script has permissions / access to everything in the script?

  5. If you can’t get any joy, run this command and post the output here, maybe we can start with the scheduling,

    schtasks /query /v /fo LIST /s YOURSERVER

answered Jun 16, 2009 at 14:55

nray's user avatar

I can’t answer the question directly as I don’t know specifically what the error message means (nor, therefore, how to fix it), but if I were trying to troubleshoot it I would add a few writes to a log file at strategic points in the script and then after the scheduled time see what the last checkpoint to run is.

My suspicion would be that there’s something that’s failing due to the credentials the script is running under or something in the script needs a logged-in user. Narrowing down where in the script things fail might help you find the «offending» code.

answered May 13, 2009 at 5:02

cori's user avatar

coricori

3811 gold badge8 silver badges16 bronze badges

I realize this is an old posting but they’re very helpful when searching for solutions and maybe what I found can be helpful too. I was using WinSCP on Windows Server 2003 to upload to an ftp server and received the same error message and the SchedLgU.txt file pointed to not enough time in the «Stop the task if it furn for:» section even though I gave the task plenty of time to upload.

Looking in Task Manager I could see that WinSCP.exe wasn’t clearing out and I had tons of the processes in the list, so I created a batch file (taskkill /f /im winscp.exe) to kill any opened process and I have that batch file run before the WinSCP and it works well now.

answered Feb 2, 2011 at 22:08

susand's user avatar

I ran into this today on a remote server, and the solution was to change the run setting from «Run only when the user is logged on» to «Run whether the user is logged in or not».

With «Run only when the user is logged on» the task launches a command window that was closed when my remote desktop session timed out. With «Run whether the user is logged in or not» no window is displayed while the task runs, so the execution does not stop when my remote desktop session ends.

answered Mar 6, 2018 at 16:23

VolleyJosh's user avatar

Similar to cori’s answer I would recommend that you check who the scheduled task is set to run as, as I have seen this error occur when the user account that is running the task doesn’t have the same permissions as the logged in user

answered May 13, 2009 at 5:07

Glenn Slaven's user avatar

Glenn SlavenGlenn Slaven

2,4002 gold badges30 silver badges42 bronze badges

If this ran before, perhaps a condition like a network outage or a problem on another host can explain the failure.

answered Aug 2, 2011 at 3:27

Ted Taylor's user avatar

I had the same error and it was because the batch file I was running was prompting for some files to delete with DEL command. As there is no user to answer Y/N to batch process the scheduled task is terminated.
The following is the message I have found on my scheduled tasks log:
«the task was terminated. This action was initiated either by an administrator or by the Task Scheduler service (because, for example, the computer is now non idle).»
My recommendation is to run the task manually from the command prompt to see where it is stopping or prompting for some user interaction, correct it and your task will run fine.

answered Jun 19, 2013 at 14:23

ruddwall's user avatar

If you are trying to run the program under Task Scheduler control, the System.Environment.CurrentDirectory will return C:\Windows\System32, NOT where your executable is located. This error can be a file-not-found error; I was trying to log to a subdirectory and it didn’t exist in the System32 tree.

answered May 27, 2014 at 18:29

roadkill42's user avatar

At my scripts this is clear.
It happen’s cause i have «pause» at the end of batch file and scheduled task is limited to 20 minutes. When user is present, hi can see flow of the job. When isn’t batch file is terminated by scheduled task, after 20 min. This is causing 0xc000013a and it’s ok.

answered Aug 12, 2011 at 5:23

Danko's user avatar

I had the same issue and fixed it by changing the trigger from «On system startup» to «On logon».

answered Feb 6, 2014 at 20:55

Andrei G's user avatar

had the same problem..
fixed by playing with user who is registered to run the scheduled task.
in the end, changing the domain was the answer.

answered Jun 10, 2014 at 5:53

tal's user avatar

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

I am trying to schedule TNUC to run at login. I do not believe there is an option to do so, and would simply like to try this out. I think I’ve previously put a shortcut in the Startup folder, but don’t see why this shouldn’t work. I am also doing this as I want the window to stay open. Therefore I want to run it through powershell, with the ‘-NoExit’ parameter.

Steps to reproduce

(Download TinyNvidiaUpdateChecker)
Create a new scheduled task. I have set it to use the highest privilege and to configure for «Windows 10». The trigger is «At login» and the actual task is to start a program.

Use «pwsh.exe» as the program. Powershell 7.0.3 is on my path, so this will open that (I have checked manually). You can point to it directly, it doesn’t matter.
Then add the -NoExit and -File "path-to-TinyNvidiaUpdateChecker" arguments as the optional arguments. Click «Ok» and complete the task.

Expected behavior

TinyNvidiaUpdateChecker is run (in a console window) and the console expects an input when the script is done (As a result of the NoExit tag).

Actual behavior

When this task is run, the following window appears. This seems like a weird error. Powershell Window

In Task Scheduler, the task has the error 0x40 if I use the full path for powershell, or 0xC000013A if I just use «pwsh.exe» as the application.

What am I doing wrong?

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Понравилась статья? Поделить с друзьями:
  • 0xc000012f windows 10 как исправить ошибку
  • 0xc0000135 ошибка и как ее устранить windows 10
  • 0x8100203 ошибка windows 10
  • 0x81000101 ошибка архивации windows
  • 0x81000037 ошибка архивации windows 7