【.cmd】 バッチファイルスクリプト %12 【.bat】at TECH
【.cmd】 バッチファイルスクリプト %12 【.bat】 - 暇つぶし2ch533:デフォルトの名無しさん
18/05/02 03:07:32.00 KFhIKBMV.net
batでも出来るんだけど、実用な時間で出来るかと言われると何ともねえ
@echo off
setlocal
set hex=0123456789ABCDEF
set in=1234567890
set out=
set bin=
:loop
call :div2 in s
set bin=%s%%bin%
if defined in goto :loop
:loop2
set h=000%bin:~-4%
set /a h=("%h:~-4,1%<<3")+("%h:~-3,1%<<2")+("%h:~-2,1%<<1")+%h:~-1%
set bin=%bin:~0,-4%
call set out=%%hex:~%h%,1%%%out%
if defined bin goto :loop2
echo.0x%out%
endlocal
goto :eof
:div2
set dst=
set s=0
:divloop
set d=%in:~0,1%
set in=%in:~1%
set /a s=s*10+d
set /a h="s>>1"
set /a s%%=2
if defined dst (set dst=%dst%%h%) else if %h% gtr 0 set dst=%dst%%h%
if not defined in set in=%dst%&goto :eof
goto :divloop


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch