标题: [文本处理] 字符串合并后删除重复字符串,求实现 [打印本页]
作者: alibabalj 时间: 2014-11-24 09:26 标题: 字符串合并后删除重复字符串,求实现
本帖最后由 alibabalj 于 2014-11-24 09:29 编辑
@echo on
set aaa="c:\;C:\Program Files(86)"
set bbb="C:\Program Files(86);d:\"
for %%i in (%aaa:"=%;%bbb:"=%)do if not defined %%i call set ccc=%%ccc%%;%%i&set %%i=y
set ccc="%ccc:~1%"
echo ccc=%ccc%
pause
我想实现 ccc = "c:\;C:\Program Files(86);d:\"
作者: DAIC 时间: 2014-11-24 10:02
- @echo off
- setlocal enabledelayedexpansion
- set aaa="c:\;C:\Program Files(86)"
- set bbb="C:\Program Files(86);d:\"
- set aaa=%aaa:;=" "%
- set bbb=%bbb:;=" "%
- set "ccc="
- for %%i in (%aaa% %bbb%) do (
- if not defined %%i (
- set "ccc=%%~i;!ccc!"
- set "%%i=1"
- )
- )
- set ccc="%ccc:~0,-1%"
- echo ccc=%ccc%
- pause
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |