Multi-Search3

GetEnvVars

There are times, in Oracle or outside of it, when we need to know values of Windows environment variables like User Domain for use in scripts.

Here is a little batch script to dynamically generate environment variable names and their values in one go.

:: =================================================
:: GetEnvVars.bat
:: =================================================
:: Get all environment variables and their values from one batch file.
:: Have you used the example from the help for Microsoft FOR command?
:: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %
:: Here is a way to get the list of variables and their values dynamically.
:: Find the output in c:\gev1.tmp1.out file.
:: =================================================
:: Jerome Christopher
:: www.sqlhtm.com/sqlhtm
::=================================================
@echo off
del c:\gevl.tmp2.out
del c:\gev1.tmp1.out

(
echo ^(
echo echo :: Generating the Environment Variables and their values...
echo echo :: Find the output in c:\gev1.tmp1.out
echo echo ^@echo off
echo FOR ^/F ^"usebackq delims^=^=^" %%%%i IN ^(^`set^`^) DO ^@echo echo %%%%i ^= %%%%%%%%i%%%%%
echo ^) ^> ^c:^\gev1.tmp1.bat
)>c:\gev1.tmp2.bat

cmd /c c:\gev1.tmp2.bat>c:\gevl.tmp2.out
cmd /c c:\gev1.tmp1.bat>c:\gev1.tmp1.out
exit

BlogCollage


Blog Collage - Top Random Posts In No Particular Order

Mouseover the images for title and comments