Logo
Lose Weight
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

Windows Server 2008 Server Core : Working at the Command Prompt (part 2) - Tracking Command Line Actions with the DosKey Utility

4/2/2012 11:19:58 AM

6. Tracking Command Line Actions with the DosKey Utility

The DosKey utility performs three tasks. First, it provides the history feature that most people use to scroll through existing command line entries. Press Down Arrow to see the next command, Up Arrow to see the previous command, Page Down to see the most recent command, and Page Up to see the oldest command in the history.

Second, you can use this command to edit previous commands. The following list describes the editing features.


LEFT ARROW

Moves to the previous character in the command.


RIGHT ARROW

Moves to the next character in the command.


CTRL+LEFT ARROW

Moves to the previous word in the command.


CTRL+RIGHT ARROW

Moves to the next word in the command.


HOME

Moves to the beginning of the line.


END

Moves to the end of the line.


ESC

Clears the command from the display.


F1

Copies the next character from the same column in the command that you previously issued.

NOTE

The system places the previous command in a special area of memory called the template and lets you work with that command based on the current column position. For example, if you typed Dir *.BAK as the previous command, executed it, and then typed Dir at the command line, pressing F1 would type a space. Pressing F1 again would type the asterisk (*) and so on. Using the same example, pressing F2 and then the letter A would display Dir *.BA at the command prompt. Using the combination of the template and function keys helps you reduce the number of keystrokes you make to type a command.


F2

Searches forward in the previous command for the next key you type after pressing F2.


F3

Copies the remainder of the previous command to the command line.


F4

Deletes characters from the current cursor position up to a character you specify. For example, if the command line currently displays Dir *.BAK and the cursor is blinking under the asterisk (*), pressing F4 and the letter B would change the command prompt to read Dir BAK.


F5

Copies the previous command into the current command line.


F6

Places an end-of-file character (Ctrl+Z) at the current cursor position. You typically use this feature when using the console to create a file.


F7

Displays all of the commands stored in the command history in a dialog box. Select a command using the Up Arrow and Down Arrow. Press Enter to select the command. DosKey types the selected command at the command prompt. Press Enter again to execute the command. You can also note the sequential number in front of the command and use this number with the F9 key.


ALT+F7

Deletes all commands stored in the current command history buffer.


F8

Displays a single command from the command history that starts with the characters in the current command. Press F8 multiple times to cycle through the list of matching commands.


F9

Prompts you for a history buffer command number, and then displays the command associated with the number you specify. Press Enter to run the command. Press F7 to display a list of commands in the command history buffer, along with their associated command number.


ALT+F10

Deletes all macro definitions.

Third, you can use this command to create macros. The macros automate some command line tasks, similarly to batch files, but far more inconveniently. You can also use these macros to interact with applications. This utility uses the following syntax:

DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
  [/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename]
  [macroname=[text]]

					  

The following list describes each of the command line arguments.


/REINSTALL

Installs a new copy of DosKey. Use this feature when your current copy has become corrupted or simply filled with extraneous data.


/LISTSIZE=size

Determines the number of commands that will fit within the command history buffer. The default setting is 10.


/MACROS

Displays a list of all of the DosKey macros. The output includes command line macros, as well as those associated with an application.


/MACROS:ALL

Displays a list of all the DosKey macros for all executables that have DosKey compatibility. For example, if you create a DosKey macro for the FTP utility, this command line switch would display it.


/MACROS:
exename

Displays a list of all the DosKey macros associated with the specified application.


/HISTORY

Displays a list of all of the commands in the command history buffer.


/INSERT

Places DosKey in insert mode. Any new text you type at the command line appears in addition to the existing text.


/OVERSTRIKE

Places DosKey in overstrike mode. Any new text you type at the command line replaces (overwrites) existing text.


/EXENAME=
exename

Specifies the name of an executable to use when creating a macro. The resulting macro runs within that application. The application must support DosKey to use this functionality. If you don't specify this command line switch, any macro you create or install runs at the command line and not as part of an application.


/MACROFILE=
filename

Specifies a file containing macros that you want to install.


macroname

Specifies the name for a macro you create. Typing the macro name, followed by an equals sign, and pressing Enter deletes a macro from the list.


text

Contains the text of the macro you want to record. You must include a macro name, followed by an equals sign, followed by the macro text to use this argument. For example, you can define a macro named MyDir that displays a directory by typing DosKey MyDir=Dir *.* /P and pressing Enter. After you create this macro, you can type MyDir at the command prompt, press Enter, and DosKey will execute the MyDir macro.

7. Obtaining Command Line Help with the Help Utility

In most cases, you'll type the name of a utility, followed by the /? command line switch to learn more about it. However, Microsoft decided to make things difficult in some cases. For example, some utilities require that you use the /Help command line switch instead or you might have to use the Help utility to learn more about the command or utility in question. To see a list of commands and utilities that Help supports, type Help and press Enter. This utility uses the following syntax:

HELP [command]

The following describes the command line argument.


command

Specifies the name of the command for which you want to obtain more information. If you type Help by itself and press Enter, you'll see a list of all of the available commands. You can then choose a specific command to learn more about with the Help utility.

8. Working with the System Time Using the Time Command

The Time command displays or sets the system time. This command uses the following syntax:

TIME [/T | time]

The following list describes each of the command line arguments.


/T

Displays the date without prompting for a new time. This command line switch only works when you enable command extensions.


time

Specifies the new system time.

9. Changing the Command Window Title with the Title Command

The title that a command window displays might not seem important at first, but it can be important for two reasons. First, if you have multiple command windows open, using a descriptive title can make it easier to locate the correct command window on the Windows Taskbar. Second, it's important to remember that Windows associates settings changes you make with the command window title. Changing the title affects how Windows stores the settings changes you make. The Title command can change the title of a command window. This command uses the following syntax:

TITLE [string]

The following describes the command line argument.


string

Contains the text for the command window.

Other -----------------
- Sharepoint 2007 : Customizing a SharePoint Site - Modify a Content Type
- Microsoft BizTalk 2010 : Consuming ASDK-based Adapters - ASDK tools and features
- Microsoft Dynamics AX 2009 : Working with Data in Forms - Creating custom filters
- Microsoft Dynamics AX 2009 : Working with Data in Forms - Handling number sequences
- BizTalk 2006 : Deploying and Managing BizTalk Applications - Administrative Tools (part 3) - ExplorerOM
- BizTalk 2006 : Deploying and Managing BizTalk Applications - Administrative Tools (part 2) - WMI
- BizTalk 2006 : Deploying and Managing BizTalk Applications - Administrative Tools (part 1) - BTSTask
- Windows Server 2003 : Windows Server Update Services (part 2) - Using WSUS: On the Client Side
- Windows Server 2003 : Windows Server Update Services (part 1)
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 4)
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 3) - Integrating SSMS with Source Control & Using SSMS Templates
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 2)
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 1)
- Sharepoint 2010 : Reviewing and Troubleshooting Crawls (part 2) - Using Crawl Reports & Diagnostic Logging
- Sharepoint 2010 : Reviewing and Troubleshooting Crawls (part 1) - Using Crawl Logs
- Sharepoint 2010 : Managing Crawls
- Microsoft Lync Server 2010 Monitoring : Installation (part 2) - Installing the Monitoring Server Role
- Microsoft Lync Server 2010 Monitoring : Installation (part 1) - Topology Builder for Microsoft Lync Server Monitoring Role
- Microsoft Lync Server 2010 Edge : Edge Troubleshooting
- Active Directory Domain Services 2008 : Enable a Computer Object
 
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Top 10
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
- MDT's Client Wizard : Application Properties
- MDT's Client Wizard : Operating System Properties
- MDT's Client Wizard : Customizing the Deployment Share
- Windows Server 2012 : Software and User Account Control Administration (part 5) - Maintaining application integrity - Configuring run levels
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro