Create macros with the DOSKEY utility in Windows NT
Takeaway: The DOSKEY utility allows you to create simple but powerful macros. Learn more about this powerful utility.
The command line is one of the most neglected parts of Windows NT, and many users aren't aware of everything it can do. For example, how many of your users can create a macro?Windows NT includes a powerful DOSKEY utility that allows you to create simple but powerful macros. It even features the ALIASES command. When you enter a command, the shell checks if there's a DOSKEY macro present in memory before checking for internal commands.
Here's the basic syntax for DOSKEY macros. To access all other options, enter DOSKEY /? at the command prompt.
DOSKEY [macroname=[command]]
Let's look at some sample macros.
DOSKEY c=cls
This macro allows you to enter c at the command prompt instead of cls to clear the screen.
DOSKEY d=dir /o /p $*
This macro displays the contents of the folder, listed alphabetically one screen at a time.
You can also run more than one command with a macro. Here's an example:
DOSKEY nd=md $1$Tcd $1
Entering nd myfolder creates a new folder (myfolder) and switches to it. This is basically the same as entering the md myfolder and cd myfolder commands separately.
Once you create your collection of macros, save them to a file. To do so, enter DOSKEY /macros > filename.
You can load them into memory by entering DOSKEY /macrofile=filename. This is especially useful because macros don't persist through the session, meaning they're lost once you close the command prompt. By storing them in a file, you can easily reload them later. If you want to delete a macro from memory, enter DOSKEY macroname =.
However, macros do have limitations. For example, you can't run them from a batch file. In addition, their powerful nature can render the command prompt completely inoperable. For instance, you could create macros that have the same names as commands, such as DIR, COPY, and even DOSKEY itself.
White Papers, Webcasts, and Downloads
- The Impact of Virtualization Software on Operating Environments VMware Today's use of virtualization technology allows IT professionals to ... Download Now
- Why Isn't Server Virtualization Saving Us More? A Few Small Changes May Dramatically Increase Your Efficiency VMware Ever wonder why your company isn't saving more from its server virtualization? Making a few small changes could dramatically increase your efficiency. Download Now
- Email Security and Archiving - Clearer in the Cloud Google The time is NOW for businesses and organizations of all sizes to implement ... Download Now
- The True Costs of Virtual Server Solutions VMware Discover ways to streamline and simplify your assessment of the total acquisition costs of a server virtualization environment. Download Now
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

