28 lines
490 B
Batchfile
28 lines
490 B
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
set input=in.txt
|
|
set output=out.txt
|
|
set prefix=D:\Works\TestTestTest\
|
|
|
|
del %output%
|
|
|
|
for /f "tokens=*" %%a in (%input%) do (
|
|
set "line=%%a"
|
|
set "line=!line:/=\!"
|
|
echo %prefix%!line! >> %output%
|
|
)
|
|
|
|
echo 添加前缀并替换完成.
|
|
|
|
for /f "tokens=*" %%b in (%output%) do (
|
|
if exist "%%b" (
|
|
del "%%b"
|
|
echo 成功: 文件删除成功: %%b
|
|
) else (
|
|
echo 错误: 文件不存在或删除失败: %%b
|
|
)
|
|
)
|
|
|
|
echo 操作完成.
|
|
pause |