开发者

changing text in all files and subfolders

I need to change all references to text "home-page.aspx" to "index.aspx"

I used it a lot in my whole project but now I need to change that name. I dont k开发者_StackOverflow社区now powershell well so could someone help me witch rewriting all "home-page.aspx" texts in all files and subfolders of my project folder ?

lets say project folder name is D:\Project1

Thank You very much for help


Try this:

Get-ChildItem D:\Project1 -Recurse | Select-String -Pattern 'home-page.aspx' -SimpleMatch | Foreach-Object{
    $content = Get-Content $_.Path
    $content -replace 'home-page.aspx','index.asp' | Out-File $_.Path   
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜