Batch file 在echo命令中转义所有文本
我在一个批处理文件中制作文本艺术,有没有办法避开回声中所有的垂直条Batch file 在echo命令中转义所有文本,batch-file,Batch File,我在一个批处理文件中制作文本艺术,有没有办法避开回声中所有的垂直条 不使用^s插入符号会关闭文本行。只是一些选项。还有更多,但这取决于实际需要 @echo off :: Using delayed expansion setlocal enabledelayedexpansion set "x=|| this is delayed expansion test ||" echo(!x! echo( endlocal
不使用^s插入符号会关闭文本行。只是一些选项。还有更多,但这取决于实际需要
@echo off
:: Using delayed expansion
setlocal enabledelayedexpansion
set "x=|| this is delayed expansion test ||"
echo(!x!
echo(
endlocal
:: Using escaping
setlocal disabledelayedexpansion
set "x=|| this is escaping test ||"
echo(%x:|=^|%
echo(
endlocal
:: Reading the data from the current file
for /f "delims=: tokens=1,*" %%x in ('findstr /r /c:"^:::1:" "%~f0"') do echo(%%y
for /f "delims=: tokens=1,*" %%x in ('findstr /r /c:"^:::2:" "%~f0"') do echo(%%y
exit /b
:::1:||||||||||||||||||||||||||||||||||||||||||||||
:::1:|| ||
:::1:|| this is a test ||
:::1:|| ||
:::1:||||||||||||||||||||||||||||||||||||||||||||||
:::2:||||||||||||||||||||||||||||||||||||||||||||||
:::2:|| ||
:::2:|| this is another test ||
:::2:|| ||
:::2:||||||||||||||||||||||||||||||||||||||||||||||