I’ve blogged in the past about Wayne Martin and his outstanding list of command line tips. These are one line commands, some complex some simple, that you can use to accomplish a wide range of task. The overall number of tips is to 425 and Wayne recently reorganized them into 7 categories to make it easier for people to digest. There’s very little scripting with any of these commands. Most use native or freely available command line tools. But because they are executed from a command line you could incorporate them into a script. I encourage you to check them out.
In the past I’ve posted a collection of command one-liners that get a ton of work done with (relatively) minimal effort. Many of these have come from Wayne Martin. I’ve been behind in my blogging while book writing, but I wanted to make sure you checked out his latest list at:
One of my more popular blog entries is the one I did about CMD one-liners. These are little tidbits of commands that can get a lot done. The list came from a reader and I was happy to share. Wayne has now started a blog Wayne’s World of IT which will carry on this theme of command line automation. It’s just getting started but I hope you’ll check it out. Wayne assures me he has a growing list of one-liners to publish.
A few of my recent Mr. Roboto columns have been about group auditing. I first published an HTA that would report on group membership last December. Astute reader Matt V. found a bug with the way nested group memberships were being reported. Or in this case, not being reported. It turns out that if a group was a member of one other group, that membership was not reported. But if the group was nested in 2 or more groups then you’d see all the nested groups. After a little debugging I found my goof. I used ADSI to get a reference to the specified group:
strDN would have a value like CN=Sales,OU=Groups,DC=Mycompany,DC=local. My mistake was in assuming that the MemberOf property would always be a collection so I was using a ForEach construct. But it is only a collection if there is more than one group. So I modified the code:
<span class="kwrd">If</span>IsArray(objGroup.MemberOf)<span class="kwrd">Then</span><br/>Trace<span class="str">"MemberOf is a collection"</span><br/><span class="kwrd">For</span><span class="kwrd">Each</span>member<span class="kwrd">In</span>objGroup.MemberOf<br/>Trace<span class="str">"found member of "</span>&member<br/>strMemberOf=strMemberof&<span class="str">" "</span>&member&VbCrLf<br/><span class="kwrd">Next</span><br/><span class="kwrd">Else</span><br/>Trace<span class="str">"found member of "</span>&objGroup.MemberOf<br/>strMemberOf=strMemberof&<span class="str">" "</span>&objGroup.MemberOf&vbcrlf<br/><span class="kwrd">End</span>If
Because I used the same code in a followup article where I released a command line version of the tool, I had to modify that tool as well. The above code snippet is actually from the WSF version.
Anyway, both versions have now been updated and are available for download from the Mr. Roboto section of my script library. Thank you Matt for keeping me on my toes.
This week’s Windows Tip Sheet column is about opening an Explorer window from the command prompt. One of my readers sent me an email about using this tip in Vista:
I’m currently running Vista and when I type “explorer.exe /e, %cd%” I get the same results as “explorer.exe /e /root, %cd%”. So is /root really necessary? Wouldn’t it be faster to remove it if you get the same results?
He’s right in that you essentially end up with an Explorer window opened to the current directory. But there is a subtle difference that might matter to you. When you use /root, you should see that folder tree in the left hand pane is “rooted” to the specified folder. When you do it without /root, the folder tree is the full tree showing your computer, network places and the rest.
On my Vista Ultimate laptop, I didn’t really notice any performance difference between using /root or not. It would save you from typing a bit, but I use a batch file anyway.
It boils down to how you intend to use the Explorer window. If you want to easily navigate away from the current folder, then don’t use /root. The command is flexible so do what works for you.