1

The problem is for .ts files which currently Windows identifies them as video format.

I want .ts files that are videos open with video player and .ts files that are TypeScript open with code editor.

Any solution?

Sina
  • 11

1 Answers1

2

A very simple-minded idea is to distinguish between the two cases by the size of the file being launched, since video files are much larger.

You can create a program to intercept in Explorer the double-click on .ts files that will launch either the player or an editor. This can done even by just a .bat file that has the file as its parameter.

An (untested) model for such a .bat file is :

@echo off
setlocal
set maxbytesize=10000

FOR /F "usebackq" %%A IN ('%1') DO set size=%%~zA

if %size% LSS %maxbytesize% (
    editor.exe '%1'
) else (
    player.exe '%1'
)

You would need to designate this script as handler for .ts files. See for that this StackOverflow answer.

If you wish to avoid the black rectangle in which the .bat script will execute, see the post
Run a batch file in a completely hidden way.

harrymc
  • 498,455