I would like to run a file, in cmd without knowing the type (e.g. JPG, mp3, txt, mp4 and etc).
I tried to use 'start' command, but start (as far I found) need to know the full name of the file (with extension) and which program it should use to run it (e.g. VLC, notepad, photo viewer).
So, for example, instead of using C:\AI>start "VLC media player" "Bernard.avi"
I want something like C:\AI>start "Bernard"
to work similar.
cmd, Open file in Command Prompt shell without knowing its extension
1.5k views Asked by Z.A.M At
2
If you are sure only one file has that filename you use a for loop to search for the file like this:
In your example it would be:
You can put it in a batch-script:
and give the path to the filename without extension as argument (don't forget the surrounding double quotes).
If multiple files have that filename it will open them all.