Solved

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

Posted on 2016-08-31
7
47 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 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no backā€¦
Troubleshooting common task sequence error codes
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

832 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