要批量?
-
- '//保存我为1.vbs
- On Error Resume Next
- Dim objArgs,strInput,strOutput,sngNum,strRes,strLast
- Set objArgs=WScript.Arguments
- If objArgs.Count=0 Then WScript.Quit
- strInput=objArgs.Item(0)
- strLast=Right(Trim(strInput),1)
- sngNum=Left(Trim(strInput),Len(strInput)-1)
- Select Case LCase(strLast)
- Case "k"
- strOutput=sngNum*1024
- Case "m"
- strOutput=sngNum*1024*1024
- Case "g"
- strOutput=sngNum*1024*1024*1024
- Case "t"
- strOutput=sngNum*1024*1024*1024*1024
- End Select
- WScript.Echo strInput&" = "&strOutput&" 字节"
复制代码
用法:- cscript /nologo 1.vbs 一个参数如1M
复制代码
批量事例:- @echo off
- for /f "delims=" %%i in ('more +7 "%~f0"') do (
- cscript /nologo 1.vbs %%i
- )
- pause&exit
-
- 1m
- 4k
- 76g
- 456k
- 8567m
- 45g
复制代码
|