Saturday, March 3, 2007

Windows Command-line kungfu with WMIC

Dành cho những ai lỡ dại mê shell trên *nix nhưng vẫn phải làm việc trên windows:
C:\> wmic process [pid] delete

That's the rough equivalent (for you UNIX/Linux minded folks) of "kill -9 [pid]".

Or, better yet, try this one on for size:

C:\> wmic process where name='cmd.exe' delete

I love that one! It functions something like "killall -9 cmd.exe" would on a Linux box, where killall lets you kill processes by name.

And, check this out:

C:\> wmic process list brief /every:1

Sort of like (but not exactly) the Linux/UNIX top command.

But, wait! There's more...

C:\> wmic useraccount

This one gives a lot more detail than the old "net user" command. With "wmic useraccount" you get user names, SIDs, and various security settings.

Fun, fun, fun! Here's another:

C:\> wmic qfe

This one shows all hotfixes and service packs. For you old-school Sun-heads out there (both of you! -- Just Kidding), qfe doesn't stand for Quad Fast Ethernet... It stands for Quick Fix Engineering in this context.

For a list of some of the items WMIC can touch, run this:

C:\> wmic /?

No comments: