Is there a way to list all executables available with your current PATH (environment variable) setting with a batch file?
I've been trying for a while and I can't seem to find a way (i ain't no batch intellectual).
Please help if you can even a link to an article can be useful. Thank you!
surprisingly simple:
for %a in (%pathext%) do where *%a
the %pathext%
lists all defined file extension that are executable (.exe, .bat, ...) and where
lists all findings within the %path%
Note: this is command line syntax. For use in a batch file, use %%a
instead of %a
As an addition to the already provided answer, and as a result of @aschipfl's comment, the following should use only the locations defined in the %Path%
environment variable, and not include the current directory, (unless that itself was in %Path%
).
From the Command Prompt:
For %A In (%PathExt%) Do @Where $Path:*%A 2>Nul
And from a batch file:
@For %%A In (%PathExt%) Do @Where $Path:*%%A 2>Nul
Obviously if you were only looking for .exe
files as opposed to executables it would be much simpler:
Where $Path:*.exe 2>Nul
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With