<http://www.netikka.net/tsneti/info/tscmd173.htm>
Copyright © 2003-2010 by Prof. Timo Salmi  
Last modified Mon 3-May-2010 00:58:54

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



173} How do I get the original GUI path since CLI's may be changed?

  @echo off & setlocal enableextensions
  :: System-wide
  for /f "tokens=2,*" %%a in ('
    reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"
      ^|findstr "Path"^|findstr "REG_EXPAND_SZ"') do echo %%b
  echo.
  :: User specific
  for /f "tokens=2,*" %%a in ('
    reg query "HKEY_CURRENT_USER\Environment\"
      ^|findstr "PATH"^|findstr "REG_EXPAND_SZ"') do echo %%b
  endlocal & goto :EOF

GUI = graphical user interface
CLI = command line interface



  @echo off & setlocal enableextensions
  echo %%USERNAME%%=%USERNAME%
  echo.
  echo %path%
  pause
  endlocal & goto :EOF




References/Comments: (If a Google message link fails try the links within the brackets.)
  Google Groups 12 Feb 2009 13:25:15 [M]
  How To Manage Environment Variables in Windows XP
  Environment Variables in Windows XP