(view source code of capture.bat as plain text)
@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: Check command line arguments (only 1, optional)
IF NOT "%~2"=="" GOTO Syntax
IF NOT "%~1"=="" IF NOT EXIST "%~f1" GOTO Syntax
ECHO "%~1" | FINDSTR.EXE /R /C:"[/?*]" >NUL && GOTO Syntax
:: Navigate to the default directory for CAPTURE.TIF
PUSHD C:\
:: Navigate to an alternative directory, if specified
CD /D "%~f1" 2>NUL
:: No directory is no problem, non-existing directory is
IF ERRORLEVEL 1 (
POPD
GOTO Syntax
)
:: Locate the IrfanView main executable
START /WAIT REGEDIT.EXe /E "%Temp%.\~capture.tmp" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IrfanView"
:: Abort if IrfanView wasn't found
IF NOT EXIST "%Temp%.\~capture.tmp" GOTO Syntax
:: Use IrfanView to capture the screen
FOR /F "tokens=2 delims==" %%A IN ('TYPE "%Temp%.\~capture.tmp" ^| FINDSTR.EXE /R /I /C:".UninstallString.="') DO (
"%%~dpAi_view32.exe" /capture /silent /append=capture.tif /killmesoftly
)
:: Delete temporary file
DEL "%Temp%.\~capture.tmp"
:: Done, return to original directory
POPD
GOTO:EOF
:Syntax
ECHO.
ECHO Capture.bat, Version 1.00 for Windows 2000 and later
ECHO Append a screen dump to a multi-page TIF file
ECHO.
ECHO Usage: CAPTURE.BAT [ tif_dir ]
ECHO.
ECHO Where: "tif_dir" is the path where the multi-page TIF file
ECHO "capture.tif" will be saved (default: C:\)
ECHO.
ECHO Note: This batch file requires IrfanView (http://www.irfanview.com)
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
page last modified: 2024-04-16; loaded in 0.0050 seconds