相关疑难解决方法(0)

在Windows批处理中打印段落

以下代码可以很好地打印段落

@echo off
setlocal disableDelayedExpansion
set "skip="
for /f "delims=:" %%N in (
  'findstr /x /n ":::BeginText" "%~f0"'
) do if not defined skip set skip=%%N
>test.txt (
  for /f "skip=%skip% tokens=*" %%A in (
   'findstr /n "^" "%~f0"'
  ) do (
    set "line=%%A"
    setlocal enableDelayedExpansion
    echo(!line:*:=!
    endlocal
  )
)
type test.txt
exit /b

:::BeginText
This text will be exactly preserved with the following limitations:

  1) Each line will be terminated by CR LF even if original has only LF. …
Run Code Online (Sandbox Code Playgroud)

windows batch-file

4
推荐指数
1
解决办法
2644
查看次数

标签 统计

batch-file ×1

windows ×1