0 / 0 / 1 Регистрация: 25.01.2018 Сообщений: 73 |
|
1 |
|
15.02.2019, 08:20. Показов 7045. Ответов 2
Есть задача запускающая CMD файл от имени администратора, на WIn 7 и Win 8 все работает отлично, на Win10 ошибка 0xFF
0 |
Заблокирован |
|
15.02.2019, 08:23 |
2 |
У меня на Linux sigkill работает норм. Наверное винду надо переустановить.
0 |
Модератор 15824 / 7859 / 742 Регистрация: 03.01.2012 Сообщений: 32,551 |
|
15.02.2019, 11:09 |
3 |
РешениеА пароль у Администратора на десятке установлен? Не менялся после создания задачи?
1 |
I have a scheduled task that runs a batch file, and even though I can see the results of it completing successfully, according to the task scheduler it fails with error 0xff, every time.
I have other batch files scheduled that also complete successfully and return 0x0 as they should. The only difference I can see between these files is that the working ones end with:
IF ERRORLEVEL 1 (
("notify me" script here)
)
whereas the broken one ends with:
IF %2==something (
(run a program here)
IF ERRORLEVEL 1 (
(same "notify me" script here)
)
)
Does an IF block return 0xff if false or something? What’s the deal?
masegaloeh
18.2k10 gold badges57 silver badges106 bronze badges
asked Sep 21, 2009 at 13:54
The syntax you’re looking for is:
IF "%2"=="SOMETHING" (
When %2 is empty, the line you have becomes:
IF ==SOMETHING (
That’s invalid syntax. Putting the quotes in it makes it:
IF ""=="SOMETHING" (
That’s valid.
answered Sep 21, 2009 at 14:05
Evan AndersonEvan Anderson
142k20 gold badges196 silver badges331 bronze badges
1
After some testing, I figured out that IF blocks are okay, they don’t seem to change the error level, but what was messing it up was the «%2==something»—the times that were failing, there was no second parameter being passed to the batch file. So I’m not sure how to «safely» test for whether a parameter exists (i.e., without it erroring out 0xff when it’s not there) except maybe to have yet another IF ERRORLEVEL after that. But anyway, I just changed the scheduled task so it will always have a second parameter (whether it’s «something» or not) and it seems to return 0x0 as it should now.
answered Sep 21, 2009 at 14:02
KevKev
9844 gold badges24 silver badges46 bronze badges
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
Если у вас не выполняются назначенные задания в Планировщике и в столбце «прошлый результат» код ошибки отличный от нуля, то расшифровку кодов можно посмотреть на следующих ресурсах:
Устранение неполадок, связанных с назначенными заданиями в Windows XP и Windows Server 2003
Обычные коды для назначенных заданий следующие:
0x0: Операция выполнена успешно.
0x1: Вызов неверной или неизвестной функции.
0xa: Ошибка в среде.
В поиске проблемы может помочь журнал планировщика в папке Windows с именем Schedlgu.txt.
Расширенное описание кодов ошибок можно прочитать в MSDN:
Task Scheduler Error and Success Constants (для Windows 2008 server и Windows Vista)
System Error Codes
После некоторого тестирования я выяснил, что, ЕСЛИ блоки хорошо, они, кажется, не изменяют ошибочный уровень, но что портило его, были «%2 == что-то» — времена, которые перестали работать, не было никакого второго параметра, передаваемого пакетному файлу. Таким образом, я не уверен, как «безопасно» протестировать на то, существует ли параметр (т.е. без него erroring 0xff, когда это не там) кроме, возможно, чтобы иметь еще один, ЕСЛИ ERRORLEVEL после этого. Но так или иначе, я просто изменил запланированную задачу, таким образом, она будет всегда иметь второй параметр (является ли это «чем-то» или не), и это, кажется, возвращает 0x0, как она должна теперь.
ответ дан Kev
3 December 2019 в 09:29
Ссылка
- Remove From My Forums
-
General discussion
-
Schedule task (0xFF) Error while running Batch file via schedule task. I am trying To start a Windows service name Contain «abc 4.0(2010)» I think this is due to Special charactor and space. Anybody have solution for this.
-Sarit
All replies
-
You must capture the error generated by your batch file command, e.g. like so:
@echo off
if not exist c:\Logs md c:\Logs
echo %date% %time% 1>>c:\Logs\Task.log
net start «MyService» 1>>c:\Logs\Task.log 2>>&1The contents of the log file should tell you what’s wrong.
-
Edited by
Wednesday, October 23, 2013 12:10 PM
-
Edited by