15 lines
512 B
PowerShell
15 lines
512 B
PowerShell
|
# 定义路径前缀
|
||
|
$oldPath = 'D:\App\html\www.sinoso.com.cn\'
|
||
|
$newPath = 'C:\Users\28322\Desktop\hxxl\templates\'
|
||
|
|
||
|
# 读取原始文件并逐行处理
|
||
|
Get-Content -Path 'webcopy-origin.txt' | ForEach-Object {
|
||
|
# 只替换以指定路径开头且以 .html 或 .htm 结尾的完整路径
|
||
|
if ($_ -match [regex]::Escape($oldPath) + '.*\.(html|htm)$') {
|
||
|
$_ -replace [regex]::Escape($oldPath), $newPath
|
||
|
}
|
||
|
else {
|
||
|
$_ # 保留原内容
|
||
|
}
|
||
|
} | Set-Content -Path 'webcopy-updated.txt'
|