生成固定大小的文档

注意:用写字板保存

@echo off

:MAIN
echo.  
echo.★★★★★★★★★★★
echo.★   [1] 按KB生成   ★
echo.★   [2] 按M生成    ★
echo.★   [3] 按G生成    ★
echo.★   [4] 退出       ★
echo.★★★★★★★★★★★ 
echo.         
echo.★请选择要进行的操作,然后按回车

set /p choice=选择按类型生成文件:
if /i "%choice%"=="1" goto KB
if /i "%choice%"=="2" goto M 
if /i "%choice%"=="3" goto G
if /i "%choice%"=="4" goto END 

:KB
set /p tmp=请输入文件大小:
set /a result=tmp*1024
fsutil file createnew %~dp0\test%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt %result%
echo.生成完毕
goto MAIN

:M
set /p tmp=请输入文件大小:
set /a result=tmp*1024*1024
fsutil file createnew %~dp0\test%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt %result%
echo.生成完毕
goto MAIN

:G
set /p tmp=请输入文件大小:
set /a result=tmp*1024*1024*1024
fsutil file createnew %~dp0\test%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt %result%
echo.生成完毕
goto MAIN

:END
@ECHO ON

 

你可能感兴趣的:(生成固定大小的文档)