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

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

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

%dfsexe% -l:%1 query %2 %3 %4 %5 %6 %7 %8 %9
echo.
echo Disk and partition information has been appended to the logfile
echo.
goto end

:usage
echo Get a file with minimal disk and partition information
echo to request help via email or on newsgroups.
echo.
echo Usage:  %0  [logfilename] [optional params, like 'part' command]
echo.
echo Examples:
echo  %0     laptop        Show query and log it to 'laptop.log'
echo  %0     -disk:2       Only show info on second physical disk
echo  %0     -v            Verbose list ALL partitions (large file!)
echo  %0     -t- -m- -w    Just show warnings about partitions and disks
echo.
echo Note: When running it multiple times, with the same logfilename,
echo       all information is APPENDED to the same file!
:end
