When you right click a file in Windows Explorer, and press Open With, the file extensions 'Open With" list is displayed.
I have scripted OpenWith.bat to display the Programs that are configured in the 'Open With" list for the current user, like my .jpq 'Open With':
shimgvw.dll mspaint.exe agent.exe Psp.exe prntscrn.exe iexplore.exe PWConsole.exe hpqthb08.exe googleearth.exe shimgvw.dll Psp.exeUsing WhatPath.bat and OpenWith.bat, I have scripted a sample usage:
@echo off if \{%1\}This produces the following output for my .jpg extension:\{\} @echo .FileExtension required&goto :EOF setlocal ENABLEDELAYEDEXPANSION set ext=%1 if "%ext:~0,1%" NEQ "." @echo .FileExtension required&endlocal&goto :EOF for /f "Tokens=*" %%a in ('OpenWith %ext%') do ( set prog=%%a call WhatPath !prog! FQFN @echo "%ext%";"!prog!";!FQFN! ) endlocal
".jpg";"shimgvw.dll";rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen ".jpg";"mspaint.exe";"C:\WINDOWS\system32\mspaint.exe" ".jpg";"agent.exe";"agent.exe" ".jpg";"Psp.exe";"C:\PROGRA~1\PAINTS~1\Psp.exe" ".jpg";"prntscrn.exe";"prntscrn.exe" ".jpg";"iexplore.exe";"C:\Program Files\Internet Explorer\iexplore.exe" ".jpg";"PWConsole.exe";"PWConsole.exe" ".jpg";"hpqthb08.exe";"C:\Program Files\HP\Digital Imaging\bin\hpqthb08.exe" ".jpg";"googleearth.exe";"C:\ProgramFiles\Google\Google" ".jpg";"shimgvw.dll";rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen ".jpg";"Psp.exe";"C:\PROGRA~1\PAINTS~1\Psp.exe"OpenWith.bat contains:
@echo off if \{%1\}\{\} @echo Syntax OpenWith .Ext&goto :EOF setlocal ENABLEDELAYEDEXPANSION set ext=%1 if "%ext:~0,1%" NEQ "." @echo Syntax OpenWith .Ext&endlocal&goto :EOF set ext=%ext:"=% set qry=reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\%ext%\OpenWithList" set wrk="%TEMP%\OpenWith_%RANDOM%.TMP" if exist %wrk% del /q %wrk% call :quiet>nul 2>&1 set qry=reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\%ext%\OpenWithProgids" call :qfile>nul 2>&1 if not exist %wrk% endlocal&goto :EOF type %wrk% del /q %wrk% endlocal goto :EOF :quiet for /f "Tokens=2*" %%a in ('%qry%^|find /i /V "MRUList"^|find "REG_SZ"') do ( @echo %%b>>%wrk% ) goto :EOF :qfile for /f "Tokens=1*" %%i in ('%qry%^|find "REG_NONE"') do ( for /f "Tokens=*" %%k in ('ftype %%i^|find /i "%%i="') do ( set ft=%%k set ft=!ft:"=! set ft=!ft:%%i=! for /f "Tokens=1-8 Delims=\ " %%s in ('@echo !ft!') do ( call :ftx %%s %%t %%u %%v %%w %%x %%y %%z ) ) ) goto :EOF :ftx if \{%1\}==\{\} goto :EOF set ftx1=%1 shift if /i \{%ftx1%\} EQU \{rundll32.exe\} goto ftx set ftx2=%ftx1:.=% if \{%ftx1%\} EQU \{%ftx2%\} goto ftx @echo %ftx1%>>%wrk%
0 comments
Hide comments