See the windows shell commands
assoc
. Associates a filename extension (e.g. *.txt) with a file type.
ftype
. Lets you create a new file type that tells the windows shell how to open a particular kind of file.
From a command prompt, typing assoc /?
or ftype /?
will get you help on them. Or use your google-fu to find the MS docs.
*.bat
is mapped to the file type batfile
; *.cmd
is mapped to the file type cmdfile
. In windows 7 they are identical. If you want to be able to run files named *.foobar
as a batch files, just type:
assoc .foobar=cmdfile
Then, assuming a file named 'sillyness.foobar' existing on the path, you just just type
c:\> sillyness
and it will find sillyness.foobar
and execute it as a batch file. The Windows shell has a priority for how it resolves conflicts when you have files with the same name and different extensions (.com vs .cmd vs .bat, etc.)
Something like
assoc .pl=perlscript
ftype perlscript=perl.exe %1 %*
will set you up to run perl scripts as if they were .bat files.