Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8594263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:09:26+00:00 2026-06-12T00:09:26+00:00

$FilePath = ‘Z:\next\ResourcesConfiguration.config’ $oldString = ‘Z:\next\Core\Resources\’ $NewString = ‘G:\PublishDir\next\Core\Resources\’ Any Idea how can you

  • 0
$FilePath = 'Z:\next\ResourcesConfiguration.config'
$oldString = 'Z:\next\Core\Resources\'
$NewString = 'G:\PublishDir\next\Core\Resources\'

Any Idea how can you replace a string having : sign in it. I want to change the path in a config file. Simple code is not working for this. tried following

(Get-Content $original_file) | Foreach-Object {
 $_ -replace $oldString, $NewString
 } | Set-Content $destination_file
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:09:27+00:00Added an answer on June 12, 2026 at 12:09 am

    The Replace operator takes a regular expression pattern and ‘\’ is has a special meaning in regex, it’s the escape character. You need to double each backslash, or better , use the escape method:

    $_ -replace [regex]::escape($oldString), $NewString
    

    Alterntively, you can use the string.replace method which takes a string and doesn’t need a special care:

    $_.Replace($oldString,$NewString)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following filepath var imagepath=C:\Documents and Settings\Mahesh\Desktop\images\advts.png how can I replace \
UPDATE files SET filepath = REPLACE(filepath, `sites/somedomain.com/files/`, `sites/someotherdomain.com/files/`); I have a table called files
Response.ContentType = Application/pdf; string FilePath = Server.MapPath(reliance.pdf); Response.WriteFile(FilePath); Response.End(); How can we resize the
So I have the following code: public static void Replace(filepath) { try { XElement
How can I print the filepath and filename values from each row? Array (
What is the difference (if any) in writing: if (File.Exists(filePath)) //Something else throw new
Can somebody pls tell me how to get the filepath using html <input type=file>
Can you please tell me the grep pattern for matching the following filepath: ../any_directoryname/filename.txt
How can I specify filepath to imagepng function? It always seems to create the
How can one determine the absolute filepath of the WCF service root folder that's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.