如何通过bat批处理去掉一个文本文件中的<>符号及其中的内容?
一个文本文件中有多个<>符号及其括起来的内容,如<A>、<B>、<C>……。怎样通过bat批处理去掉它们呢?...
一个文本文件中有多个<>符号及其括起来的内容,如<A>、<B>、<C>……。怎样通过bat批处理去掉它们呢?
展开
3个回答
展开全部
兄弟··楼上那个说的很对,你真想去掉它们就直接用记事本打开,然后查找<和>符号,然后批量替换就可以了,你何必把自己弄的那么累呢,有时候简单的东西是最好的~~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
The following codes may help you in some way. But strongly recommend you choose VBS regular expression to do the job. It will be much quicker and more universal.
@ECHO OFF
IF NOT EXIST "%~1" GOTO :EOF
ECHO 请稍后. . .
SET newName="%~dpn1_uu%~x1"
SETLOCAL EnableDelayedExpansion
(FOR /F "usebackq delims=" %%I IN ("%~1") DO (
SET "U=%%I"
CALL :UU U
ECHO.!U!))>%newName%
START "" %newName%
GOTO :EOF
:UU
SET /A L=0 & SET "UT=!%1!" & SET "%1="
:U_N
IF NOT DEFINED UT GOTO :EOF
SET "B=!UT:~0,1!"
IF "!B!"=="<" (SET /A L+=1) ELSE (
IF "!B!"==">" (SET /A L-=1) ELSE (
IF %L% EQU 0 SET "%1=!%1!!B!"))
IF %L% LSS 0 (SET /A L=0 & SET "%1=!%1!>")
SET "UT=!UT:~1!"
GOTO :U_N
REM --------END--------
Save above codes into a batch file, e.g. "uu.cmd", which can be put in any folder. DRAG any text file onto the icon of "uu.cmd", then you will see the result. Please Hi me if any problem.
@ECHO OFF
IF NOT EXIST "%~1" GOTO :EOF
ECHO 请稍后. . .
SET newName="%~dpn1_uu%~x1"
SETLOCAL EnableDelayedExpansion
(FOR /F "usebackq delims=" %%I IN ("%~1") DO (
SET "U=%%I"
CALL :UU U
ECHO.!U!))>%newName%
START "" %newName%
GOTO :EOF
:UU
SET /A L=0 & SET "UT=!%1!" & SET "%1="
:U_N
IF NOT DEFINED UT GOTO :EOF
SET "B=!UT:~0,1!"
IF "!B!"=="<" (SET /A L+=1) ELSE (
IF "!B!"==">" (SET /A L-=1) ELSE (
IF %L% EQU 0 SET "%1=!%1!!B!"))
IF %L% LSS 0 (SET /A L=0 & SET "%1=!%1!>")
SET "UT=!UT:~1!"
GOTO :U_N
REM --------END--------
Save above codes into a batch file, e.g. "uu.cmd", which can be put in any folder. DRAG any text file onto the icon of "uu.cmd", then you will see the result. Please Hi me if any problem.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询