[英]How to change a certain windows setting using python?
I need to change this setting on/off using python:我需要使用 python 更改此设置的开/关:
'Automatically hide the taskbar in desktop mode' '在桌面模式下自动隐藏任务栏'
I have looked over the internet and can't find any ways to change the settings - this can be via python or command line.我查看了互联网,找不到任何更改设置的方法 - 这可以通过 python 或命令行。
What I'd really need is something like:我真正需要的是:
hideTaskbar = True # Hides taskbar
hideTaskbar = False # Shows taskbar
Hide隐藏
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=3;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
Show节目
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=2;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
import subprocess
showing = "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=2;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
hiding = "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=3;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
def run(cmd):
subprocess.run(["powershell", "-Command", cmd])
run(hiding)
run(showing)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.