@echo off
rem 09-08-2016 JvW Use 'dfsrunas.exe' to elevate Windows to admin, ignoring explicit window sizes

if "%OS%"==""        goto notnt
if "%OS%"=="DOS"     goto notnt
if "%OS%"=="MSDOS"   goto notnt
if "%OS%"=="DRDOS"   goto notnt
if "%OS%"=="IBMDOS"  goto notnt
if "%OS%"=="OPENDOS" goto notnt
if "%OS%"=="FREEDOS" goto notnt

ver | findstr /i /C:"XP [" > nul
if %errorlevel% EQU 0 goto winxpnt
ver | findstr /i /C:"Version 5" > nul
if %errorlevel% EQU 0 goto winxpnt
ver | findstr /i /C:"NT [" > nul
if %errorlevel% EQU 0 goto winxpnt
ver | findstr /i /C:"Version 4" > nul
if %errorlevel% EQU 0 goto winxpnt

set dfsexe=dfsrunas dfswin.exe
goto dfsee

:winxpnt
set dfsexe=dfswin.exe
goto dfsee

:notnt
set dfsexe=dfsdos.exe
:dfsee
set cmdext=BAT

if "%1" == ""   goto usage
if "%1" == "?"  goto usage
if "%1" == "/?" goto usage
if "%1" == "-?" goto usage

%dfsexe% -l- -Q -d- -w edit -screen %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end

:usage
echo.
echo Usage:  %0  filename  [other 'edit' parameters]
echo.
echo      filename     : Name of a file to be edited in binary (HEX/ASCII)
echo.
echo      -p:pos       : Position of cursor on initial file sector loaded
echo.
echo      -M:position  : start position of an initial marked area in edit window
echo      -m:bytes     : size in bytes for initial marked area (see Alt-B/L/U/F)
echo      -s:size      : size of each item to be edited (default is 1 sector)
echo      -c:cols      : number of columns in edit dlg  (default 8, 16 or 32)
echo      -r:rows      : number of rows in edit dialog  (default whole screen)
echo      -d           : start in alternate, disassembler view, maximized
:end
