Of course, sometimes you will have to check the command documentations for errors from specific commands.
But with whatever information I know, I have explained the same as given below :-
The return codes are in hexadecimal. You can convert them to
decimal with a hex mode calculator or if you are using
NT/W2k/XP, by using «set /a 0xff» or by simple multiplication.
Multiply the second last number by 16 and add the last number
where A-F represents decimal 10-15 e.g. 0xB3 = 11*16+3 = 179.
0x0 = 0 = no error
0xff = 255 = More than 154 files failed to copy or ^C batch exit or
possibly scheduled task failed to run.
0x68 = 104 = 4 files failed to copy
0x67 = 103 = 3 files failed to copy
etc, etc,.
Hemant
0 / 0 / 1 Регистрация: 25.01.2018 Сообщений: 73 |
|
1 |
|
15.02.2019, 08:20. Показов 5028. Ответов 2
Есть задача запускающая CMD файл от имени администратора, на WIn 7 и Win 8 все работает отлично, на Win10 ошибка 0xFF
0 |
Заблокирован |
|
15.02.2019, 08:23 |
2 |
У меня на Linux sigkill работает норм. Наверное винду надо переустановить.
0 |
Модератор 15222 / 7805 / 734 Регистрация: 03.01.2012 Сообщений: 32,188 |
|
15.02.2019, 11:09 |
3 |
Сообщение было отмечено RIOCADM как решение РешениеА пароль у Администратора на десятке установлен? Не менялся после создания задачи?
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 badges105 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 badges195 silver badges330 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 badges23 silver badges46 bronze badges
И аналогично ответу LotPings:
@Echo Off
CD /D "%~dp0"
For %%A In (1 2 3) Do Call :Sub "%%A"
Pause
GoTo :EOF
:Sub
For /F "Delims= = " %%A In ('Set line[ 2^>Nul') Do Set "%%A = "
Set "total = "&Set "randlinenum = "
For /F "Tokens=1*Delims=[]" %%A In ('Find /V /N ""^<"foto%~1.txt"'
)Do Set "line[%%A]=%%B"&Set "total=%%A"
Set /A randlinenum=1+(%RANDOM% %% total)
SetLocal EnableDelayedExpansion
Echo(!line[%randlinenum%]!
(Echo(!line[%randlinenum%]!)>"urlfoto%~1.txt"
EndLocal
Exit /B
Обратите внимание, что конструкция Find /V /N «», (или FindStr /N «^»), также будет включать любые пустые строки, поэтому, если они существуют в каком-либо из ваших файлов foto*, возможно, случайным образом будет выбрана и выведена пустая строка.
I want to run php script through windows task scheduler.
Following is the content of .bat file —
cd C:test_folder
"C:Program Files (x86)PHPv5.6php.exe" -f test.php
This .bat file executes successfully if I run it manually but fails in task scheduler showing last run result as 0xFF.
I have multiple versions of PHP installed and have to run test.php on older version. That is why I have to mention full path of php.exe even though PHP environment variable is set.
asked Nov 11, 2019 at 9:36
code_poetrycode_poetry
3231 gold badge5 silver badges16 bronze badges
Do any of the folders have restricted access? Try setting it up so that the scripts runs with highest privileges or that the account it’s running under has proper access to the folders required and see if that fixes it.
Also, try dropping the «-f».
answered Apr 27, 2021 at 14:14
zelarianzelarian
1211 silver badge4 bronze badges