Skip navigation

JSI Tip 9169. How can I test that all folders in my PATH exist?


I have scripted FinPNX.bat to report any folders in your %PATH% that do NOT exist.

The syntax for using FinPNX.bat is:

FinPNX

FinPNX.bat contains:

@echo off
setlocal ENABLEDELAYEDEXPANSION
for %%f in ("%PATH:;=";"%") do if not exist %%f set NE=!NE!;%%f
if defined NE (
 call :list
 ) ELSE (
 @echo OK
)
endlocal
goto :EOF
:list
for %%f in (%NE:;= %) do @echo %%f
NOTE: See these other PATH related tips:

What command will return the folders in my PATH, one per line?

How can I test if a folder is in my PATH?

How do I check for duplicate path entries on all my Windows NT 4.0+ clients?

EditPath.exe freeware is a Win32 console program that allows you to manipulate the current user and system path environment variables in the registry.

How can I tell if a file is located in my PATH, or other set of folders?

How do I add a folder to the Windows 2000 / Windows XP PATH, in a batch?

FixPath freeware checks for the minimum required directories in your path.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish