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 1)

4/2/2012 11:18:20 AM
Some commands and utilities help you create a better working environment at the command prompt. In many cases, these commands are aesthetic; they don't do any useful work in the sense of modifying a file or the system state. The following sections describe these efficiency commands and utilities.

Creating a Nice Work Environment

You might wonder why you would spend time learning about commands and utilities that don't do any useful work. For me, it's the same reason for having carpeting on the floor or a remote for the television; it's all about comfort. For example, you'll find that the display buffer eventually becomes full of extraneous data you don't really want to see any longer. Sure, you could ignore the garbage on your screen, but it's a lot better to get rid of it so you can work in comfort. Using the CLS command clears the display buffer for you so you can continue working efficiently.

Users of your batch file and script applications want a nice working environment too. You'll often use these commands and utilities in your batch files to provide special effects. The CLS command clears the display so the user viewing the output of the batch file doesn't become confused.


1. Redirecting Command Line Output to the Clipboard with the Clip Utility

Anyone who has used redirection knows the benefits of sending output data to another location, such as a file, or getting input from another location, such as the COM port. The Clip utility lets you perform redirection using the Windows Clipboard. You use redirection or the pipe command as you normally do. For example, Dir | Clip sends the output for the directory command to the clipboard. This command uses the following syntax:

Clip

You don't need to supply any command line switches when using this command. It works much like the More command. For example, if you want to place the output of the Dir command on the clipboard, you would type Dir | Clip and press Enter. At this point, you can type Notepad and press Enter to start the Notepad utility. Select Edit Paste and you'll see the output of the Dir command in Notepad, where you can edit the information to suit your needs.

2. Clearing the Display with the CLS Command

The Clear Screen (CLS) command clears the screen buffer and presents you with a clean display. All that remains is the command prompt. This command uses the following syntax:

CLS

You don't need to supply any command line switches when using this command.

3. Managing Usernames and Passwords with CmdKey

The CmdKey utility helps you manage username and passwords. Using this utility, you can display, create, and delete credentials as needed. However, this utility only works with the current user. In other words, the credentials you manage are for the current user, not for another user on the same system. To work with other users, you must first log in as that user. Consequently, this command works well with login batch files that perform tasks on the user's behalf, but not necessarily as a good tool for administering users at the command line.

A system can have two kinds of passwords managed by CmdKey. The first is generic passwords that you can use anywhere. For example, you might create a username and password to access a remote system using a Virtual Private Network (VPN). The second is domain passwords that you use to access a domain server. These password types appear in the Type field output when you list credentials for your system.

3.1. Displaying

The /list command line switch lets you list all of the credentials associated with the current account. This mode uses the following syntax:

cmdkey /list
cmdkey /list:targetname

The following list describes each of the command line arguments.


/list

Displays all of the entries or only those that you specify with a target name.


targetname

Defines a target credential. You use the name of the credential as the target. This command line argument doesn't allow wildcard characters, so you can only use it to list one credential at a time.

3.2. Creating

Creates a new domain or generic credential based on a username and password. Use the /add command line switch to create domain credentials and the /generic command line switch to create generic credentials. This mode uses the following syntax:

cmdkey /add:targetname /user:username /pass:password
cmdkey /add:targetname /user:username /pass
cmdkey /add:targetname /user:username
cmdkey /add:targetname /smartcard
cmdkey /generic:targetname /user:username /pass:password
cmdkey /generic:targetname /user:username /pass
cmdkey /generic:targetname /user:username
cmdkey /generic:targetname /smartcard

The following list describes each of the command line arguments.


/add

Creates a domain credential.


/generic

Creates a generic credential.


targetname

Defines a target credential. You use the name of the credential as the target. This command line argument doesn't allow wildcard characters, so you can only use it to list one credential at a time.


/user:
username

Specifies the username used for login purposes. The username can include any qualifiers required to perform the login.


/pass or /pass:
password

Specifies the password used for login purposes. If you specify /pass without the password, the system prompts you for a password to use on the remote system. Unlike many password prompts, this prompt doesn't display the password characters as asterisks (*), so it's easy to make mistakes. Make sure you type the password carefully.


/smartcard

Creates a password based on the content of a smartcard. The system prompts you to provide the smartcard as part of the input.

3.3. Deleting

You can't change a credential using the CmdKey utility. To change a credential, you must first delete the old credential and then create a new one. In addition, you'll likely find that you need to delete old credentials when you don't need them any longer. This mode uses the following syntax:

cmdkey /delete:targetname
cmdkey /delete /ras

The following list describes each of the command line arguments.


/delete:
targetname

Removes the specified credential. You must provide a target name unless you're deleting a Remote Access Server (RAS) credential.


/ras

Specifies that you want to remove a RAS credential.

4. Changing Screen Colors with the Color Command

The Color command changes the foreground (text) and background colors of the command window. This command uses the following syntax:

COLOR [FG]

The following describes the command line argument.


FG

Sets the foreground (F) and background (G) colors. You must place the values together, without any space between. If you use the Color command without specifying color values, the command changes the colors to the default values used when you opened the command window. The following list tells you which colors you can use at the command prompt, along with their associated color number.

0—Black

1—Blue

2—Green

3—Aqua

4—Red

5—Purple

6—Yellow

7—White

8—Gray

9—Light blue

A—Light green

B—Light aqua

C—Light red

D—Light purple

E—Light yellow

F—Bright white

5. Working with the System Date Using the Date Command

The Date command displays or sets the system date. This command uses the following syntax:

DATE [{/T | date}]

The following list describes each of the command line arguments.


/T

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


date

Specifies the new system date.

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