String replacement not working in powershell script at runtime
I have powershell file in which i have line of variable decalration as below
[string] $global:myExePath = "\\myshare\code\scripts";
I want to replace \\myshare\code\scripts with \\mynewshare\code1\psscript
at runtime by executing a powershell script.
I am using
Get-Content $originalfile | ForEach-Object { $_ -replace
"\\myshare\code\scripts", $mynewcodelocation.FullName } | Set-Content
($originalfile)
If am execuing { $_ -replace "scripts", $mynewcodelocation.FullName } it
is working fine, but it is not working for { $_ -replace
"\\myshare\code\scripts", $mynewcodelocation.FullName }
What is wrong here ?
No comments:
Post a Comment