명령 프롬프트 창을 열고 유형 set /?
:
[...] Numeric values are decimal numbers, unless prefixed by 0x for hexadecimal numbers, and 0 for octal numbers. So 0x12 is the same as 18 is the same as 022. Please note that the octal notation can be confusing: 08 and 09 are not valid numbers because 8 and 9 are not valid octal digits. [...]
당신은 진수로 0
를 선도하는 set /A
취급 번호를 찾을 수 번호. 1
와
접두사 수와 계산 후 다시 제거 :
이 문제를 극복하기 위해, 다음을 수행 할 수 있습니다이를 위해
set last_two=1!file_name:~-2,2!
set /A add_millisec=last_two+1
set add_millisec=!add_millisec:~-2!
당신이 총 수를 알 필요가 사전에 숫자의.
set last_two=!file_name:~-2,2!
rem The following line removes all leading zeros:
for /F "tokens=* delims=0" %%Z in ("!last_two!") do set last_two=%%Z
set /A last_two+=0 & rem this avoids `last_two` to be empty if it is `0`
set /A add_millisec=last_two+1
set add_millisec=0!add_millisec!
set add_millisec=!add_millisec:~-2!
을 또는 :
필요에 따라 이후 모든 계산과 패드 앞에 0이 붙는 결과를 후행 0을 제거 당신이 알고하지 않는
set last_two=!file_name:~-2,2!
rem The following two lines remove all leading zeros:
cmd /C exit !last_two!
set /A last_two=!ErrorLevel!
set /A add_millisec=last_two+1
set add_millisec=0!add_millisec!
set add_millisec=!add_millisec:~-2!
이 방법은 더 유연 자릿수.
[잘못된 번호입니다. 숫자 상수는 십진수 (17), 16 진수 (0x11) 또는 8 진수 (021)]입니다 (http://stackoverflow.com/questions/9762794/invalid-number-numeric-constants-are-either-decimal-17-hexadecimal -0x11-o) –
0으로 시작하는 상수는 8 진수 값이지만 8와 9는 유효한 8 진수가 아니므로 –
예, 8과 9는 8 진수가 아니기 때문에 오류가 발생합니다. 거기에 내가 이것을 피하고 내 흐름을 계속할 수있는 방법은 무엇입니까 – Bharath