Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I know this is old, but FWIW; I always run into wanting this for some reason or another. Some time ago, I wrote myself a script to do this. I put a little polish on it and posted it on my blog.</p> <p>Feel free to use it.</p> <p>It's called epath, and the file is at inzi.com. It's compiled as an EXE for easy use (using vbsedit): <a href="http://inzi.com/2013/09/epath-exe-view-path-broken-out-in-lines-from-the-command-prompt/" rel="nofollow">here</a></p> <p>You can download the exe there. Here's the source code to the script if you want it as a vbs script.</p> <pre><code> scriptname = Wscript.ScriptName 'objFSO.GetFileName(WScript.FullName) Function BubbleSort(arrData,strSort) 'borrowed from here: http://vbscripter.blogspot.com/2008/03/q-how-do-i-sort-data-in-array.html 'Input: arrData = Array of data. Text or numbers. 'Input: strSort = Sort direction (ASC or ascending or DESC for descending) 'Output: Array 'Notes: Text comparison is CASE SENSITIVE ' strSort is checked for a match to ASC or DESC or else it defaults to Asc strSort = Trim(UCase(strSort)) If Not strSort = "ASC" And Not strSort = "DESC" Then strSort = "ASC" End If For i = LBound(arrData) to UBound(arrData) For j = LBound(arrData) to UBound(arrData) If j &lt;&gt; UBound(arrData) Then If strSort = "ASC" Then If UCase(arrData(j)) &gt; UCase(arrData(j + 1)) Then TempValue = arrData(j + 1) arrData(j + 1) = arrData(j) arrData(j) = TempValue End If End If If strSort = "DESC" Then If UCase(arrData(j)) &lt; UCase(arrData(j + 1)) Then TempValue = arrData(j + 1) arrData(j + 1) = arrData(j) arrData(j) = TempValue End If End If End If Next Next BubbleSort = arrData End Function If Wscript.Arguments.Count&gt;0 Then Set args = Wscript.Arguments bInLines = False bInAlphabetical = False bReverseSort = False bShowHelp = False For Each arg In args Select Case arg Case "-l" bInLines = True Case "-a" bInAlphabetical = True Case "-r" bReverseSort = True Case Else bShowHelp=True End Select Next If bInLines = False Then bShowHelp=True End if If bShowHelp Then sTxt = sTxt + "" &amp; vbCrLf sTxt = sTxt + scriptname &amp; " Displays the system path in optionally friendly formats." &amp; vbCrLf sTxt = sTxt + "ePath is helpful when viewing the system path and easily identifying folders therein." &amp; vbCrLf sTxt = sTxt + "" &amp; vbCrLf sTxt = sTxt + "EPATH [-l] [-a] [-r]" &amp; vbCrLf sTxt = sTxt + "" &amp; vbCrLf sTxt = sTxt + "Switches:" &amp; vbCrLf sTxt = sTxt + vbTab + "[-l]" + vbtab + "Show the path broken out in lines" &amp; vbCrLf sTxt = sTxt + vbtab + "[-a]" + vbTab + "Sort the path broken out in lines sorted alphabetically" &amp; vbCrLf sTxt = sTxt + vbtab + "[-r]" + vbTab + "Reverse the alphabetic sort [asc default] (ignored without -a)" &amp; vbCrLf sTxt = sTxt + "" &amp; vbCrLf sTxt = sTxt + vbTab + "Examples:" &amp; vbCrLf sTxt = sTxt + vbTab + vbTab + scriptname &amp; vbTab &amp; "(Show %PATH% normally)" &amp; vbCrLf sTxt = sTxt + vbTab + vbTab + scriptname &amp; " -l" &amp; vbCrLf sTxt = sTxt + vbTab + vbTab + scriptname &amp; " -l -a" &amp; vbCrLf sTxt = sTxt + vbTab + vbTab + scriptname &amp; " -l -a -r" &amp; vbCrLf sTxt = sTxt + vbTab + vbTab + scriptname &amp; " -? Display help (what you are seeing now)" &amp; vbCrLf sTxt = sTxt + "" &amp; vbCrLf sTxt = sTxt + "More info or questions at http://inzi.com" &amp; vbCrLf Wscript.Echo sTxt WScript.Quit Else Set wshShell = CreateObject( "WScript.Shell" ) sPath = wshShell.ExpandEnvironmentStrings( "%PATH%" ) thePath = Split(sPath,";") If bInAlphabetical Then If bReverseSort Then sDirection = "DESC" End If thePath = BubbleSort(thePath, sDirection) End if For Each item In thePath WScript.Echo item Next Set wshShell = Nothing End if Else 'Nothing, echo the path. Set wshShell = CreateObject( "WScript.Shell" ) WScript.Echo wshShell.ExpandEnvironmentStrings( "%PATH%" ) Set wshShell = Nothing End If </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload