“set u” tip

Typing “set” from a command prompt will show the environment variables currently in use in that particular command prompt session. As I do a lot of batch file scripting I tend to give my variable names a two character prefix of xx. This enables me to see the status of all my variables at the end of the set statement.  Yes I know that I should really use zz but historically I had a case to use x and therefore I’ve stuck with xx.

Anyway, about a month ago I accidentally hit the enter key too quickly but stumbled across the fact that you don’t actually need to complete the set statement from a command prompt in order to see variables and typing in “set x” will show you only the variables beginning with x.

If you change the set statement to be “set u” you return a lot of the information that you were probably trying to obtain – the username, domain,dns and profile location – all very quickly and tidy.  I thought this was really neat, told my tech support guys this trick and they’ve used it several times. Yesterday I was on a support session with Microsoft and was pleased to see they used the exact same command.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.