View Single Post
Old 01-04-2017, 12:30 PM   #8
latepaul
Wizard
latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.
 
latepaul's Avatar
 
Posts: 1,270
Karma: 10468300
Join Date: Dec 2011
Device: a variety (mostly kindles and kobos)
The following "wrapper" batch file will convert the 8.3 filename back to the long version and then call ebook-viewer.exe with it:

Code:
@echo off
REM VIEWER.BAT - a wrapper for Calibre's ebook-viewer.exe 
REM 
REM This script expects a filename in 8.3 format, it will 
REM convert it to a long filename and call ebook-viewer

if "%1" == "" (
	echo VIEWER.BAT - Missing filename
	goto :eof
)

REM get the directory name of the filename passed in
FOR /f  "tokens=*" %%A IN ('echo %~dp1') DO (
   set DIR_NAME=%%A
)

REM convert filename to long format
FOR /f  "tokens=*" %%A IN ('dir /b %1') DO (
   set LONG_NAME=%%A
)

REM pass the full filename to ebook-viewer
REM Change the path to Calibre if necessary
"C:\Program Files (x86)\Calibre2\ebook-viewer.exe" "%DIR_NAME%\%LONG_NAME%"
I've knocked this up quickly and done minimal testing. Use at your own risk.
latepaul is offline   Reply With Quote