Windows 在 PATH 中搜索可执行文件的相对顺序是什么? [英] What's the relative order with which Windows search for executable files in PATH?

查看:16
本文介绍了Windows 在 PATH 中搜索可执行文件的相对顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有 a.com、a.cmd、a.bat 和 a.exe 文件 %PATH%,如果我只调用命令a",Windows 会选择哪个?这是 M$ 官方指定的某个地方吗?

If I have a.com, a.cmd, a.bat, and a.exe files %PATH%, which one would Windows pick if I invoke just the command "a"? Is this officially spec-ed somewhere by M$?

我只是想用 -n 包装我的 gvim.exe 可执行文件,但我的 gvim.bat 似乎既不能从命令行运行,也不能从运行"对话框运行.

I just wanted to wrap my gvim.exe executable with -n, but my gvim.bat doesn't appear to get run neither from the command line, nor from the Run dialog.

推荐答案

请参阅命令搜索序列(在 Microsoft Docs 上)

See the command search sequence on Microsoft Docs

PATH 和 PATHEXT 环境变量各自提供搜索序列的一个元素:PATH 是目录where"的有序列表.查找,PATHEXT 是要查找的文件扩展名(what")的有序列表(以防命令行上未明确提供扩展名).但是,在使用 PATH 之前,会搜索当前目录.

The PATH and PATHEXT environmental variables each provide an element of the search sequence: PATH is the ordered list of directories "where" to look, and PATHEXT is the ordered list of file extensions ("what") to look for (in case the extension isn't explicitly provided on the command line). Prior to using the PATH however, the current directory is searched.

PATHEXT 变量默认为.COM;.EXE;.BAT;.CMD"

The PATHEXT variable defaults to ".COM;.EXE;.BAT;.CMD"

这篇关于Windows 在 PATH 中搜索可执行文件的相对顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆