- <# :
- cls&echo off&cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal \"%~f0\"|Out-String|Invoke-Expression"
- pause&exit
- #>
- $file="C:\Users\administrator\AppData\Local\Google\Chrome\User Data\Default\Preferences";
- if(-not (test-path -literal $file)){write-host ('"'+$file+'" not found');exit;}
- $f=get-item -literal $file -force;
- $f.Attributes='Archive';
- $enc=New-Object System.Text.UTF8Encoding $False;
- $json=[IO.File]::ReadAllText($f.FullName, $enc);
- $json=$json -replace '(?<="exit_type":)"[^"]*?"','"Normal"';
- $json=$json -replace '(?<="exited_cleanly":)false','true';
- [IO.File]::WriteAllText($f.FullName, $json, $enc);
- $f.Attributes='Readonly','Archive';
复制代码
|