zoukankan      html  css  js  c++  java
  • 自己写的一个用于往文件中插入字符串及空格的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

  • 相关阅读:
    Outlook 邮件助手
    飞花令
    青蛙跳台阶
    如何提问,找到去说谎国的路
    如何计时一个小时十五分钟
    旋转数组的最小元素
    谁养鱼?
    小龙赚了多少?
    下一行是什么?
    5 = ?
  • 原文地址:https://www.cnblogs.com/xcwytu/p/3616382.html
Copyright © 2011-2022 走看看