コマンドプロンプトウィンドウを開き、タイプ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!
または:
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