mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-14 06:34:40 +08:00
20 lines
546 B
PowerShell
20 lines
546 B
PowerShell
Try {
|
|
Write-Output "Set power plan to high performance"
|
|
|
|
$HighPerf = powercfg -l | ForEach-Object { if ($_.contains("High performance")) { $_.split()[3] } }
|
|
|
|
# $HighPerf cannot be $null, we try activate this power profile with powercfg
|
|
if ($null -eq $HighPerf) {
|
|
throw "Error: HighPerf is null"
|
|
}
|
|
|
|
$CurrPlan = $(powercfg -getactivescheme).split()[3]
|
|
|
|
if ($CurrPlan -ne $HighPerf) { powercfg -setactive $HighPerf }
|
|
|
|
}
|
|
Catch {
|
|
Write-Warning -Message "Unable to set power plan to high performance"
|
|
Write-Warning $Error[0]
|
|
}
|