ftype
小猪老师 发表于 2020-06-23 11:27浏览次数:
FTYPE命令显示或修改的文件中使用的类型的文件的扩展名的关联。
The ftype command displays or modifies file types used in file extension associations.
目录:
1 ftype 运行系统环境
2 ftype syntax
ftype 运行系统环境
Windows xp
Windows vista
Windows 2000
Windows 7
Windows 8
Windows 10
ftype syntax
FTYPE [fileType[=[openCommandString]]]
fileType
|
指定要检查或更改的文件类型。
|
openCommandString
|
指定启动此类型文件时要使用的open命令。
|
输入不带参数的ftype,以显示定义了打开命令字符串的当前文件类型。当仅使用一个文件类型调用ftype时,它将显示该文件类型的当前打开的命令字符串。不为打开的命令字符串指定任何内容,ftype命令将删除文件类型的打开字符串。在打开的命令字符串中,%0或%1被替换为通过关联启动的文件名。%*获取所有参数,%2获取第一个参数,%3获取第二个参数,以此类推。%~n获取从第n个参数开始的所有剩余参数,其中n可能在2到9之间,包括9。例如:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
将允许您调用Perl脚本如下:
script.pl 1 2 3
如果您想消除输入扩展的需要,那么执行以下代码:
set PATHEXT=.pl;%PATHEXT%
脚本的调用方式如下:
script 1 2 3
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. When ftype is invoked with only 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 deletes the open string for the file type. Within an open command string %0 or %1 are substituted with the file name being launched through the association. %* 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 execute the following code:
set PATHEXT=.pl;%PATHEXT%
The script could be invoked as follows:
script 1 2 3