0

I am trying to make my Windows 8.1 system automatically take a screenshot every minute. This helps me with time tracking.

My current solution uses IrfanView. I wrote the following cmd batch file:

set IrfanView="C:\Program Files (x86)\IrfanView\i_view32.exe"
set DestDir=%~dp0.
set Cygwin=C:\cygwin64
REM see http://stackoverflow.com/questions/905226/mkdir-p-linux-windows
setlocal enableextensions

:loop

REM these for loops are really weird, but see SO
for /f "tokens=*" %%i in ('%Cygwin%\bin\date.exe +"%%y\%%m\%%d\%%H-%%M-%%S"') do set timestamp=%%i

set filename="%DestDir%\%timestamp%.png"
for %%F in (%filename%) do set dirname="%%~dpF"

if not exist %dirname% md %dirname%
%IrfanView% /ini="%~dp0" /capture=0 /convert=%filename%

%Cygwin%\bin\sleep.exe 60
goto :loop

and I put a copy of i_view32.ini in the target directory. Then I made a shortcut to the batch file and put it into the Windows 8.1 startup folder: shell:startup.

When I doubleclick the shortcut, the script starts and works fine. But it doesn't start automatically when I log in.

Why not?

The Event Log shows a BlueScreen event with image atikmpag.sys when I log in, but I do not know if that is related.

How do I work around this issue?

12
  • You say you put the batch file in the start-up directory: it is more usual to put a link there, with the script in a standard place. With the link you can control the command name and path (used in your script) and the initial directory, and you may find that it then behaves more uniformly. You can also turn echo on and log the output to a file (using cmd /c "..."), so that you can see what went on during start-up.
    – AFH
    May 27, 2015 at 11:02
  • I put a shortcut to the batch file in the startup directory. In the actual script, echo is on, but I haven't tried logging the output, thanks! May 27, 2015 at 12:00
  • Sorry, I was interrupted and misread your question. I usually check back that I have covered everything before posting, but didn't on this occasion. Mea culpa.
    – AFH
    May 27, 2015 at 13:38
  • @reinierpost: Try a simple batch file that only echoes some text and then pauses. Does that run? Also, what's the need for Cygwin utilities here when Windows can do it all?
    – Karan
    May 28, 2015 at 1:01
  • @Karan: I am just trying to get this to work. If you can tell me how to do it with Windows utilities I'll be happy. May 28, 2015 at 8:29

0

You must log in to answer this question.

Browse other questions tagged .