ftype
- help ftype
Output:
ファイル拡張子の関連付けに使われるファイル タイプを表示または変更します。
FTYPE [ファイル タイプ[=[オープンコマンド文字列]]]
ファイル タイプ 表示または変更するファイル タイプを指定します。
オープンコマンド文字列 このタイプのファイルを開くために使うコマンドを
指定します。
パラメーターを指定しないで「FTYPE」と入力すると、オープン コマンド文字列
が定義されている現在のファイル タイプを表示します。ファイル タイプ
だけを指定して FTYPE を実行すると、そのファイル タイプの現在のオープン
コマンド文字列を表示します。オープン コマンド文字列に何も指定しない
と、そのファイル タイプのオープン コマンド文字列を削除します。
オープン コマンド内の %0 または %1 は、関連付けを使って開かれる
ファイル名で置き換えられます。%* はすべてのパラメーターを取得し、
%2 は第 1 パラメーター、%3 は第 2 パラメーターを取得します。%~n は、
第 n パラメーターから最後までのパラメーターを取得します。n は、2 から 9
の値です。たとえば、
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
と入力すると、次のように Perl スクリプトが起動されます。
script.pl 1 2 3
次のようにすると、拡張子を入力する必要がなくなります。
set PATHEXT=.pl;%PATHEXT%
スクリプトは、次のようにして起動できるようになります。
script 1 2 3
Displays or modifies file types used in file extension associations
FTYPE [fileType[=[openCommandString]]]
fileType Specifies the file type to examine or change
openCommandString Specifies the open command to use when launching files
of this type.
Type FTYPE without parameters to display the current file types that
have open command strings defined. FTYPE is invoked with just a file
type, it displays the current open command string for that file type.
Specify nothing for the open command string and the FTYPE command will
delete the open command string for the file type. Within an open
command string %0 or %1 are substituted with the file name being
launched through the assocation. %* gets all the parameters and %2
gets the 1st parameter, %3 the second, etc. %~n gets all the remaining
parameters starting with the nth parameter, where n may be between 2 and 9,
inclusive. For example:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
would allow you to invoke a Perl script as follows:
script.pl 1 2 3
If you want to eliminate the need to type the extensions, then do the
following:
set PATHEXT=.pl;%PATHEXT%
and the script could be invoked as follows:
script 1 2 3
Return Code: 1