Windows 7 任务计划程序和Python - 壁纸不变
我尝试每五分钟运行一次 Python 脚本来更新 Windows 7 桌面背景。从命令行启动时它可以完美运行,但不能作为计划任务运行。
相关代码:
import ctypes
# According to MSDN/other websites
SPI_SETDESKWALLPAPER = 20
# Update wallpaper
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, pathToWallpaper, 0)
计划任务运行,并创建了我的临时.bmp(位于pathToWallpaper),但桌面没有更新。我尝试过更改任务权限,但没有成功。
我缺少什么?预先感谢您的帮助!
I am attempting to run a Python script every five minutes to update a Windows 7 desktop background. It runs perfectly when started from the command-line, but not as a scheduled task.
The relevant code:
import ctypes
# According to MSDN/other websites
SPI_SETDESKWALLPAPER = 20
# Update wallpaper
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, pathToWallpaper, 0)
The scheduled task runs, and my temporary .bmp (at pathToWallpaper) is created, but the desktop doesn't update. I've tried changing the task permissions to no avail.
What am I missing? Thanks in advance for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保计划任务正在以与您相同的权限运行。
Make sure that the scheduled task is running with the same privilege as you.