Hi,
The "-replace" operator uses regular expressions to find the specified pattern so the escape character "\" needs to be prepended to the brackets.
(Get-content "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\local state") -replace '"browser":\{"enabled_labs_experiments":\[],"last_redirect_origin":"', '"browser":{"enabled_labs_experiments":["same-site-by-default-cookies@2"],"last_redirect_origin":""'
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.