生成固定大小的文檔

注意:用寫字板保存spa

@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
相關文章
相關標籤/搜索