九零不老心
发布于 2020-05-11 / 3 阅读 / 0 评论 / 0 点赞

任务计划修改win10明亮暗黑主题模式

  1. 创建ps脚本
    晚18-早7_使用暗色主题.ps1
    #建议保存编码为:bom头 + utf8
    #晚7点到早7点 暗黑其他时间 light就行
    ${script:现在} = Get-Date

    if ( (${script:现在}.Hour -ge 19) -or (${script:现在}.Hour -le 7) )
    {
    #晚间
    #(Dark)
    Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force
    Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
    }
    else
    {
    #白天
    #(Light)
    Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force
    Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force
    }
  2. 创建任务计划