P
P
pavelpromin2014-05-25 18:02:29
cmd/bat
pavelpromin, 2014-05-25 18:02:29

Console launcher by file type/extension (Windows)

Requires a console (without gui) launcher by file type/extension to work in Windows XP...8
Is there one?
If someone can write, I compensate financially within reasonable limits.
Usercase
Launcher is called from *.bat-file, php-, python-, ...-scripts with 1 or 2 parameters,
where one of them is the path to the folder or file on the local computer or UNC path (//192.168.0.2 /file.txt)
Launcher reads its configuration file. If a type match is found, it starts the program with a parameter passed to it and exits.
If there is no match, it calls the "default" program for this file type defined in Windows.
If a digital number is passed, it launches the program under this number.
-----------------------
Console launcher by file type/extension (Windows)
launcher.exe number path where,
number (optional) is a number from 0 to 9
path (required) - the path to the file or directory. Can be any valid in Windows OS including Cyrillic, spaces, special characters, UNC, etc.
there should also be a configuration file launcher.cfg with approximately the following content

[\]                                 (это для папок)
0=explorer.exe
1=c:\totalcomd.exe
[pdf]
0=
1=d:\soft\sumatrapdf.exe
[jpeg,jpg,png]
0=
1=D:\Acdsee.exe
2=F:\Imageview.exe
...
и тд.

----------------------
Examples
> launcher.exe c:\test.txt
---> Run notepad.exe c:\text.txt
> launcher.exe c:\picture.jpeg
---> Open "Windows Photo Viewer"
> launcher.exe 2 c:\my picture.jpeg
---> Run F:\Imageview.exe "c:\my picture.jpeg"

Error handling
Doesn't complain about the absence of launcher.cfg
If the program is not specified, run "by default" for the file type (for example, 4= )
If the config for the file type is not specified, run "by default" for the file type
Ignore lines that do not match the format of the config file
Event logging
Write to launcher.log an event file with a timestamp, launch parameters, result
[YYYYMMDD HHMMSS] [ERROR] 12 c:\text.txt
[YYYYMMDD HHMMSS] [OK] 2 c:\text.txt
something like that

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question