本帖最后由 CrLf 于 2013-3-19 17:08 编辑
十进制转任意进制:- @set @n=0;WScript.Echo(parseInt(WScript.Arguments(0)).toString(WScript.Arguments(1)));/*
- @echo off
- for /f %%a in ('cscript /nologo /e:jscript "%~0" 100 2') do echo 10进制 100 转2进制为 %%a
- pause
- :*/
复制代码 任意进制转任意进制- @set @n=0;WScript.Echo((parseInt(WScript.Arguments(0),WScript.Arguments(1))).toString(WScript.Arguments(2)));/*
- @echo off
- for /f %%a in ('cscript /nologo /e:jscript "%~0" 100 8 2') do echo 8进制 100 转2进制为 %%a
- pause
- :*/
复制代码 分开的:- @echo off
- echo>>10进制转2进制.vbs WScript.Echo(parseInt(WScript.Arguments(0)).toString(2));
- echo>>2进制转10进制.vbs WScript.Echo(parseInt(WScript.Arguments(0),2));
- for /f %%a in ('cscript /nologo /e:jscript "10进制转2进制.vbs" 100') do echo 十进制 100 转为二进制是 %%a
- for /f %%a in ('cscript /nologo /e:jscript "2进制转10进制.vbs" 100') do echo 二进制 100 转为十进制是 %%a
- pause
复制代码
|