- @echo off
- set /p size=请输入要生成文件的大小(单位:G/M/K/B):
- for %%a in (G M K) do call set size=%%size:%%a=%%a%%
- if "%size:G=%" neq "%size%" (
- set filesize=%size:G=%*1024*1024*1024
- ) else if "%size:M=%" neq "%size%" (
- set filesize=%size:M=%*1024*1024
- ) else if "%size:K=%" neq "%size%" (
- set filesize=%size:K=%*1024
- ) else set filesize=%size:B=%
- for /f %%a in ('mshta VBScript:Execute("CreateObject(""Scripting.Filesystemobject"").GetStandardStream(1).Write(int(%filesize%))"^)(close^)') do fsutil file createnew "%size:B=%B.txt" %%a
- pause
复制代码
|