none
replace string in multiple fils RRS feed

  • Question

  • Hi Sir,
    
    Please:
    I have to find and to replace "SkyDrive" or similairy
    to "Onedrive" in all scripte fils..
    
    Thanks for you Help.
    
    My beste Regards,
    
    Arnold
    ===========================
    
    # Not work
    cls
    
    $includes = "C:\MMC\*.ps1"
    $find = "SkyDrive" # or similairy
    $replace = "OneDrive"
    
    function Replace-String($find, $replace, $includes)
     {
     get-childitem $includes | select-string $find -list |% { (get-content $_.LiteralPath) |% { $_ -replace $find, $replace } | set-content $_.LiteralPath }
     }
     
     
     Replace-String

    Thursday, February 20, 2014 4:16 PM

Answers

All replies