Getting blank (black) screenshot with automated screen capture using task scheduler

感情迁移 提交于 2019-12-11 00:22:48

问题


I am trying to troubleshoot a software bug in which we think an app may not be launching every time it is called. To test this, I created a series of scheduled tasks to launch the app, take a screenshot, and then close the app. These tasks are all run through .bat files.

Everything works fine except for the screenshots. When run as a scheduled task, the .jpg from the screen capture always shows a black box. If I execute the .bat file normally, the screenshot looks fine.

I am using nircmd to send the screen capture command and save it to a folder. The command I am using is as follows:

nircmd.exe savescreenshot "C:\File Path\"~$currdate.MMddyyyy$-~$currtime.HHmmss$.jpg

I am using Windows 7.


回答1:


The task created is probably running in its own logon session, even if it is running as the same user.

Make your scheduled task run as the currently logged on user.

Keith Brown wrote an old but still valid detailled explaination of the logon session SID. The relevant part is at the middle, under "http://www.microsoft.com/msj/0599/security/security0599.aspx"

You can also poke around the access rigths with EnumWinStaGui.



来源:https://stackoverflow.com/questions/11654382/getting-blank-black-screenshot-with-automated-screen-capture-using-task-schedu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!