自己写的一个用于往文件中插入字符串及空格的bat

@echo off

echo pleas input the filename:
set /p file=

:while

rem set j=0 非得写这儿 写下面:check 上面不行 希望大神指点
set j=0
echo please input the content type:
set /p type=

if %type%==q (
goto END
)

echo please input the content:
set /p input=

if %type%==n (

:check
if %j% lss %input% (
type blank.txt>>%file%
)
set /a j+=1
if %j% geq %input% (
goto while
)
goto check

)

::warning:appended a blank
if %type%==s (
call:PRINT %input% %file%
)


goto while

if %ERRORLEVEL% NEQ 0 goto ERROR

goto END

:PRINT

rem 此方法输出会多一个空格
echo | set /p message=%1>>%2 

rem 此方法输出不多空格 但会使ERRORLEVEL=1 大家使用的时候注意

::<NUL set /p message=%1>>%2

::>>%2 <NUL set /p message=%1 这样写的话 可以输入0 上一种写法会被忽略
goto:eof

:ERROR
::new line
echo.
echo something error;

:END

原文地址:https://www.cnblogs.com/xcwytu/p/3616382.html