Interview
Heard on Hanselminutes
Interview with Web developer and technologist Scott Hanselman
Jun. 12, 2006 10:00 AM
CF: Okay.
SH: So, then you are off doing some stuff and then you go and say, popd just popd and then hit enter.
CF: Cool!
SH: This is actually a stack of directories where you
have been. So you know how a lot of people write batch files, they keep
track of where they are, and you have to go cd.., cd../..
CF: Yeah.
SH: You do all this dancing. With PushD and PopD sometimes you just want to go back to where you were.
CF: Great!
SH: Now the cool tip on top of that is setting your
command prompt differently and the Craig AnDera turned me onto this and
I've got this up at http://shrinkster.com/dpn. You know how people used to customize their command prompts in the DOS days?
CF: Right.
SH: You can still do it now. If you, say, set prompt
equals $p refuse path $_, where _ means new line,$+, + is going to tell
you the depth you are in the stack, and then $g again - all this is up
at http://shrinkster.com/dpn.
You type this prompt, you will actually get a + sign right before the
> you are used to seeing. That will show you how deep in the PushD
stack you are.
CF: No kidding.
SH: So then you can see a PushD. You will see a plus
PushD again, you will see a second plus. This lets you write very
robust batch files where you can get right back to where you were
before and not have any trouble because you cd one too many times.
CF: Dude, that is sweet.
SH: Yeah, so big thanks to Craig Andera for that tip at http://shrinkster.com/dpn.
CF: That's awesome. I am going to use that tomorrow.
SH: Oh! This is what the Minutes is for, man. I am
going to use that tomorrow. If I can change the life of just one child
you are on the Minutes.
CF: Teach a man to fish.
SH: Yeah, dude, totally. And then number three because
we are talking about moving around with directories and stuff. You just
can't say enough nice things about tab completion, right? So, like we
are down here at the command prompt and we are doing PushD and PopD and
one of the things that just cannot help you too much is the tab
completion stuff, right? We all remember early versions of Windows 2000
where we are going to the registry and set the tab completion character
ourselves. But Patrick Caldwell reminded me today how many things tab
completions can do for you. You give it just the slightest hint of what
you want to do when you hit tab and they'll help you out. You type
cddoc and you hit tab. It automatically puts in SQL and backslash
documents and settings - all in quotes - all correct for you. And then
of course shift tab gets you to the other options tab and shift tab. A
lot of people think it's just a simple step forward to give you some
auto-completion, but it's so much more. Also the depth of the wildcards
that it will take. You can say *foo* and you can find a directories or
files where foo is in the middle. Sometimes you don't have full
wildcard support, but the stuff in the command line is just very well
enabled for command lines where anything Dir understands, it will
understand. So, yeah, if you use tab completion, but you don't think
you really used it to the fullest, that alongside PushD, PopD, and a
customized prompt can really make you a ninja at the command line.
CF: Absolutely.
SH: Number two. People may not think this is an
appropriate number two, but I think it is because I am all about the
big fonts, right? Changing your console font - how you can bring up a
command line and you go and click in the upper left-hand corner there
and say properties. You get a choice. You get this really lame choice
between Lucida Console and then some bitmap fonts from 1985. You can
control what goes in that font window. If you have got another mono
type font that you really like, maybe the font that you use for
programming with, you can modify the registry and get your own fonts in
there. And I have got details at http://shrinkster.com/dpo.
George Reilly actually expanded on that and made a registry key that
makes it even easier. A registry file that you can run at http://shrinkster.com/dpp.
So, a lot of people have been stealing like the Consolas font from the
Longhorn disks or from Office 12. If you search for a programmer font
on Google, there are a million different monos-based fonts, you know,
you are not relegated just to Courier New. So I would encourage people
to check out customizing their environment. I like to make my font - I
use Consolas, I go black background on a green screen, I use a 24-point
font because I want those dots to work for me, man, high dpi...
CF: Shiny.
SH: Very.
CF: And the number one cool utility and/or cool thing about Windows this week is...
SH: All the million other command-line utilities that
you already have, but don't know about. I was writing up a list of
these myself and I went up to Google to check on one of them and
discovered http://shrinkster.com/dpq,
which is a list of all of the crazy utilities you have never heard of
that exist already on your system including ones that aren't
documented.
CF: Now, these aren't things that you have to download, these are already...
SH: No, these are already on your system. You have
these now. So, once you go out to command line and we will do them
together here. So, the first one is fsutil File System Util. All sorts
of things about managing the volumes, managing your disks,
file-specific commands, file system information, file system behavior.
CF: Now these are guaranteed to exist on what?
SH: On Windows XP and 2003. Yeah, like, for example,
it might be something as simple as 'fsutil fsinfo drives,' gives you a
list of all of your current drives, that's pretty simple. But there are
lots of different other things like fsutil, fsinfo, volume info you get
details about, all of your different drives whether or not they support
case sensitivity. Whether or not they support Unicode in their file
names, whether or not they support ACLs, whether they support
compression, it's a capability querier of your file system, fsutil.
These are all things you can put into your batch files and your various
utilities because you can count on these being there all the time.
So, here's another crazy one, if you go to your command line and you
type eudcedit, this is a thing called the Private Character Editor,
eudcedit, this is actually a weird - I had no idea this was on my
system. This is the utility that you could actually build your own font
from. It's a Private Character Editor. So not really sure quite why it
is useful or interesting, there are lots of other font-building tools,
but I always find it creepy to know my machine completely and then
discover an application that I had no idea existed and this one has a
full UI for editing fonts.
It's crazy.
CF: Wow! Wow!
SH: Yeah, totally. Some useful stuff that you can use
on, like, your mom's machine or a machine you come upon that may be
buggered up as you can type sfc - it's the System File Checker. This is
the thing that will go through all of your Windows-protected system
files and it will basically overwrite and replace the "incorrect
versions" with Microsoft versions. So, if you think that you have got a
machine that's been compromised or has got an invalid driver on it or
somehow has become corrupted, sfc is a tool you can use to scan your
system either on boot or scan immediately and potentially bring it back
from the brink. And then within the context of drivers, if you type
driverquery - just one word driverquery - from the command line, you
will get a complete list of all of the drivers that are running on your
system. And there are all sorts of things if you type 'driverquery/?'
that lets you basically enumerate and list all the different installed
device drivers and their properties and even put them as a csv file.
Couple of other quick utilities disk part is a disk-partitioning tool,
another kind of hidden command line that you can use. Very dangerous,
don't hurt yourself.
CF: Yep. Use that one.
SH: Openfiles apparently will let you see all of the
different files that are open on your shares. And you can enable your
local file tracking so you can see all the open files on your system
currently.
CF: Awesome.
SH: So Service Control is like a net stop or net start
on steroids that lets you manage services and control services from the
command line. And then the last one that I thought was kind of cool is
getmac. Lets you basically get the Mac address. I always do
ipconfig/all, but now getmac just does it and tells you the status of
those particular interfaces. Pretty cool stuff.
CF: That is sweet.
SH: That's our number one thing - a million other command-line utilities that you already have.
CF: Very cool, Scott. Anything else?
SH: Yeah, so I wanted to give a shout out. I saw a pretty interesting site that Jonathan Goodyear's company is putting up called http://email2face.com
and this is a pretty clever idea. I am not sure how they are going to
get everyone in the entire universe to put their e-mail addresses and
faces up there but they are basically storing a mapping between your
e-mail address and your face. So, you go up there you add a small icon
of your face - maybe the one you use for your instant messenger and I
think that they can probably come up with some cool and creative ways
to integrate this with Outlook or different messaging tools when you
have an e-mail address and you just want to see that person's face, you
know how Outlook's context form lets you put their face in? It would be
pretty slick to have like a Web Services interface or maybe like just
the simple HTTP get where I could get someone's face from their e-mail
address. So check out email2face.
CF: It's not a real security risk because it's not so high-resolution that it's any sort of software.
SH: Yeah, it's not like email2head shot.
CF: Yeah, it's not email2highresretinalscan.
SH: Exactly, email2fingerprint, although I have got that idea all patented right now.
(Laughter)
CF: Scott, this has been a fabulous show. Thank
you so much. Great stuff as always. And makes me wonder how many more
of these shows you have got. I mean, there's a finite number of cool
things in the world.
SH: Is there, is there, Carl?
CF: We'll have to wait and see.
SH: Who hurt you, Carl Franklin, who hurt you? (Laughter). Oh! I think I have got a few more in me.
CF: All right, until next week, this is Carl
Franklin [and] Scott Hanselman, saying thanks for listening to
Hanselminutes and have a great week.
About Carl FranklinCarl Franklin has been a figurehead in the VB community since the very early days when he wrote for Visual Basic Programmers Journal. He authored the Q&A column of that magazine as well as many feature articles for VBPJ and other magazines. He has authored two books for John Wiley & Sons on sockets programming in VB, and in 1994 he helped create the very first web site for VB developers, Carl & Gary's VB Home Page. He now teaches hands-on VB .NET classes for his company, Franklins.Net. He has taught developers from Citigroup, Aetna, Fidelity Investments, Fleet Bank, Foxwoods Casino, UTC, Hubbell, Microsoft, Mohegan Sun Casino, Northeast Utilities, to name a few. Carl is co-host of a weekly talk show on his website for .NET programmers called .NET Rocks! Carl is MSDN Regional Director for Connecticut.