有没有办法在 cmd 提示符下执行仅在路径环境变量中的 files/folders 目录?

Is there a way, from the cmd prompt, to do a dir of files/folders that are only in the path environment variable?

我想在我的 C: 驱动器上从 cmd 提示符下搜索一个文件。我可以转到根文件夹 cd \ 然后使用 dir/s myfile.txt.

但我只想搜索路径环境变量中的那些文件夹。

可以吗?

where myfile.txt

搜索在当前活动目录和 path 变量

中列举的所有文件夹中完成

是的,使用以下命令:

for %a in ("%path:;=";"%") do cd %~a && dir /b /s myfile.txt