Tip of the Week: DOS Tricks - Listing the Elements of a Variable Individually

Blog Post created by ken_foster on May 5, 2014

When you use the set or echo commands in a DOS command Window to learn the value of an environment variable, it's no problem when the value is only one or two components. But when it's a PATH variable or some other one that has many components, it's not as much fun because the output is a single, wrapped line which is more difficult to read. For example:



That's no fun at all. Try this: echo %PATH:;=&echo.%



Now that's more like it.


Of course, I never remember the syntax, so I put mine in a batch script and add it to my search path.


It works for license file variables too, just replace PATH with MGLS_LICENSE_FILE.


That's it for this week! Tune in next week for another useful tip.




Special thanks to my colleague Clinton Wittstruck who provided this information.