在Windows / cmd上的可执行文件类型是什么?他们的优先级是什么? [英] what are the executable types on windows/cmd? and what are their priorities?
问题描述
例如,如果路径上有多个可执行文件,即a.exe,a.bat和用户键入'a'(回车),则执行哪个文件?
For example if there are multiple executable files on the path i.e., a.exe, a.bat and user types 'a' (enter), which file will execute?
Windows上支持哪些其他可执行格式?
What other executable formats are supported on Windows?
推荐答案
Windows查看 PATHEXT
环境变量来决定哪些文件类型被认为是可执行的:
Windows looks at the PATHEXT
environment variable to decide which file types are considered executable:
> echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
将执行具有这些扩展之一的路径上的第一个匹配文件。
The first matching file on the path that has one of those extensions will be executed.
您可以使用 assoc
和 ftype
命令来了解文件的执行方式:
You can use the assoc
and ftype
commands to find out how the file will be executed:
> assoc .msc
.msc=MSCFile
> ftype MSCFile
MSCFile=%SystemRoot%\system32\mmc.exe "%1" %*
$ b b
(您可以使用 PATHEXT
, assoc
和 ftype
使任何文件类型可执行。)
(You can use PATHEXT
, assoc
and ftype
to make any file type executable.)
这篇关于在Windows / cmd上的可执行文件类型是什么?他们的优先级是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!