Solved

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

Posted on 2016-08-31
7
39 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
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

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

Author Comment

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

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

Accepted Solution

by:
NVIT earned 500 total points
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Closing Comment

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

Either way, thanks!
0
 
LVL 23

Expert Comment

by:NVIT
Comment Utility
> ...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
Comment Utility
Thanks much!
0
 
LVL 23

Expert Comment

by:NVIT
Comment Utility
You're welcome. Have a nice day/night.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now