Solved

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

Posted on 2016-08-31
7
51 Views
Last Modified: 2016-09-02
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
0
Comment
Question by:SAbboushi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:NVIT
ID: 41778776
Would you please clarify with an example of the kind of output you'd like?
0
 

Author Comment

by:SAbboushi
ID: 41778792
For each entry in the path variables, does the directory exist or not:

c:\abc      yes
c:\def      no
0
 
LVL 24

Accepted Solution

by:
NVIT earned 500 total points
ID: 41779008
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
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Closing Comment

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

Either way, thanks!
0
 
LVL 24

Expert Comment

by:NVIT
ID: 41782334
> ...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.
0
 

Author Comment

by:SAbboushi
ID: 41782490
Thanks much!
0
 
LVL 24

Expert Comment

by:NVIT
ID: 41782498
You're welcome. Have a nice day/night.
0

Featured Post

Create Professional Looking Email Signatures

Create "Professional HTML Email Signatures" with ease.
7 Day Money Back Guarantee if not 100% Satisfied.
Affordable - Try it out for 7 Days Totally Risk Free.
Installers provided for over 45 Email clients.
Both Windows & MAC Supported.
Highly Recommended!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question