I have many videos stored on my harddrive. The ones which are of dvd or lower quality (480p, max size 7GB), I would like to open using vlc. The ones which are HD quality (720p, 1080p, size greater than 7GB), I'd like to open using PowerDVD.
All files have the same extension (.mkv). Is it possible to program file association in Windows, such that it first looks at the file type (mkv in this case), and then also at the file size. It should automatically use either vlc or PowerDVD for mkv files, based on its size.
Please let me know if such a tweak is possible.
Best Answer
You'll have to associate the MKV extension with a batch file or PowerShell/VB script that in turn performs the file size check and invokes the appropriate application.
Here's how to do it with a batch file:
Open regedit, navigate to
HKEY_CLASSES_ROOT\.mkv
and note the (Default) value. This is the ProgID. Let's assume it's mkvfile.Navigate to
HKEY_CLASSES_ROOT\mkvfile\shell\open\command
and modify the (Default) value to something like"D:\MKVSizeCheck.bat" "%1"
.Now create the
D:\MKVSizeCheck.bat
batch file with the following contents:Here's how to do it with VBScript:
Same as above.
Navigate to
HKEY_CLASSES_ROOT\mkvfile\shell\open\command
and modify the (Default) value to something likewscript //B "D:\MKVSizeCheck.vbs" "%1"
.Now create the
D:\MKVSizeCheck.vbs
file with the following contents:Note #1: Modify the paths as required obviously. Also the code above sets 500MB (= 524288000 bytes) as the threshold so change that too as per your needs (very large values may be possible only in VBScript though).
Note #2: You can always use a utility like FileTypesMan to do steps 1-2 if you're unsure about manually editing the registry.
Note #3: Using a batch file will cause a console window to flash which might be irritating. Now this can be hidden using something like Hidden Start or VBScript, but why bother when it's better to directly use VBScript in the first place.