Looking for a free program that reports on each folder in system and user path variables

SAbboushi
SAbboushi used Ask the Experts™
on
Hi-

I'm looking for a free program that reports on each folder in system and user path variables whether the folder exists or not.

W10 64
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NVITEnd-user support

Commented:
Would you please clarify with an example of the kind of output you'd like?

Author

Commented:
For each entry in the path variables, does the directory exist or not:

c:\abc      yes
c:\def      no
End-user support
Commented:
Here is a verified vbscript solution you can use.

- Make a PathDirExists.vbs file of this code
' Verify if folders in the PATH environment variable exist.
' Results are saved in file %TEMP%\PathDirExists.txt

Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Const ForAppending = 8
Dim outputArray
Dim FName
FName = objShell.ExpandEnvironmentStrings("%TEMP%") & "\PathDirExists.txt"

Set objTextFile = objFSO.OpenTextFile (FName, ForAppending, True)

'Process system PATH Env Variable
objTextFile.WriteLine("System PATH Variable=============================")
inputText = objShell.Environment("PROCESS").Item("PATH")
DoesDirExistInPath inputText

'Process user PATH Env Variable
objTextFile.WriteLine("User PATH Variable=============================")
inputText = objShell.Environment("USER").Item("PATH")
DoesDirExistInPath inputText

objTextFile.Close

Sub DoesDirExistInPath(Dir)
outputArray = split(inputText,";")

For each Dir in outputArray
	If objFSO.FolderExists(Dir) Then
		objTextFile.WriteLine("Yes=" & Dir)
	Else
		objTextFile.WriteLine("No=" & Dir)
	End If
Next
End Sub

Open in new window


- Open a CMD prompt
- Type cscript /nologo PathDirExists.vbs
- Result file PathDirExists.txt is in %temp% folder
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
Perfect!  Any chance you can get the script to open the .txt file automatically using default editor?

Either way, thanks!
NVITEnd-user support

Commented:
> ...get the script to open the .txt file automatically using default editor
Insteat of running cscript /nologo PathDirExists.vbs above, make a .bat file of this code:
cscript /nologo PathDirExists.vbs
if exist "%TEMP%\PathDirExists.txt" start "title" "%TEMP%\PathDirExists.txt"

Open in new window


Run the .bat in a CMD window.

Author

Commented:
Thanks much!
NVITEnd-user support

Commented:
You're welcome. Have a nice day/night.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial