Windows Tip Sheet

Half a Dozen One Liners

Stop me if you've heard these before: more command line script tips.

This week, I bring you more tips from my Las Vegas 2006 Techmentor command line scripting session.

1. Create a user account fast with the Net User command:

net user jsample P@ssw0rd /add

This creates a local account. If you type:

net user jsample P@ssw0rd /add /domain

the account will be created in your domain. Use /domain, do not substitute your domain name. You'll find the account in the Users container of Active Directory. It will be disabled and have no attributes defined. Still, if you need to create a bunch of accounts for testing or something, using Net User is a fast way.

2, 3. Two simple ones: Type date /t to get the current date. Type time /t to get the current time.

4. Use Pushd . to store your current directory. Go ahead and change to as many other directories as you like. When you are ready to return to the original directory, type Popd and there you are.

5. Get network and computer information, including the MAC address of remote systems by typing

nbtstat -A remote.ip.address

This is a nifty way to identify a machine and sometimes an owner when all you have is an IP address. Be sure to use capital A with the IP address.

6. If you need a quick whole number calculation, use the command prompt and the SET command like this:

set /a 1024*32

which will return 32768. This won't work with numbers like 10.4 or 3.14. You can also do division (set /a 512/64). Be aware that any results that aren't whole numbers are rounded.

If you have a command line tip that saves you a few keystrokes or from needing to grab a mouse, I hope you'll share it with me and the readers of MCPmag.com.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular

SharePoint Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.