Skip to content

Instantly share code, notes, and snippets.

@fearphage
Created September 10, 2009 11:06
Show Gist options
  • Select an option

  • Save fearphage/184476 to your computer and use it in GitHub Desktop.

Select an option

Save fearphage/184476 to your computer and use it in GitHub Desktop.
@echo off
REM save this file as a .bat or .cmd file and call it from anywhere
set _installName=Opera
if NOT #%1# == ## (for /f "useback tokens=*" %%a in ('%1') do (set _installName=%%~a))
if exist "%appdata%\Opera\%_installName%\sessions\autosave.win" (
set sessionFile=%appdata%\Opera\%_installName%\sessions\autosave.win
) else (
set sessionFile=%appdata%\Opera\%_installName%\profile\sessions\autosave.win
)
for /f "delims== tokens=1,2 usebackq" %%I in ("%sessionFile%") do (
if "%%I" == "window count" (
echo.%%J
goto DONE
)
)
:DONE
set _installName=
set sessionFile=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment