Inspired by “Leon Bambrick” blog, I’ve decided to start a Category on my blog wherein I’ll be posting small stuff that I learn that never get a chance to land up on a blog post. It can be a Tip, single line of code or concept, anything that is worth sharing.

Leon is a great guy! (Follow him on twitter @SecretGeek) . I was going through some of his work on his blog and Quickly became fan of his inclination towards learning and implementing new things.

TODAY I LEARNED :  How to identify variables in a script open Powershell ISE ?

For a small code its a piece of cake, but to identify all variables in hundreds of lines of code is Humongous task.

Well it was easy than I expected, use the Powershell parser to tokenize (A programming token is the basic component of source code, like variables, operators and separators)all content of the current open tab of ISE, then filter out variables. BOOM! here you go with the variables.

wilt

I’ve wrapped this in a function and added functionality to identify variables in all open ISE.

wilt

You can find the function on my Github Repository – http://github.com/PrateekKumarSingh/Today.I.Learned