as, aS (Set Alias)

The as and aS commands define a new alias or redefine an existing one.

as Name EquivalentLine 
aS Name EquivalentPhrase 
aS Name "EquivalentPhrase" 
as /e Name EnvironmentVariable 
as /ma Name Address 
as /mu Name Address 
as /msa Name Address 
as /msu Name Address 
as /x Name Expression 
aS /f Name File 
as /c Name CommandString 

Parameters

Name
Specifies the alias name. This name can be any text string that does not contain a space or the ENTER keystroke and does not begin with "al", "as", "aS", or "ad". Name is case sensitive.

EquivalentLine
Specifies the alias equivalent. EquivalentLine is case sensitive. You must add at least one space between Name and EquivalentLine. The number of spaces between these two parameters is not important. The alias equivalent never contains leading spaces. After these spaces, EquivalentLine includes the rest of the line. Semicolons, quotation marks, and spaces are treated as literal characters, and trailing spaces are included.

EquivalentPhrase
Specifies the alias equivalent. EquivalentPhrase is case sensitive. You must add at least one space between Name and EquivalentPhrase. The number of spaces between these two parameters is not important. The alias equivalent never contains leading spaces.

You can enclose EquivalentPhrase in quotation marks ("). Regardless of whether you use quotation marks, EquivalentPhrase can contain spaces, commas, and single quotation marks ('). If you enclose EquivalentPhrase in quotation marks, it can include semicolons, but not additional quotation marks. If you do not enclose EquivalentPhrase in quotation marks, it can include quotation marks in any location other than the first character, but it cannot include semicolons. Trailing spaces are included regardless of whether you use quotation marks.

/e
Sets the alias equivalent equal to the environment variable that EnvironmentVariable specifies.

EnvironmentVariable
Specifies the environment variable that is used to determine the alias equivalent. The debugger's environment is used, not the target's. If you started the debugger at a Command Prompt window, the environment variables in that window are used.

/ma
Sets the alias equivalent equal to the null-terminated ASCII string that begins at Address.

/mu
Sets the alias equivalent equal to the null-terminated Unicode string that begins at Address.

/msa
Sets the alias equivalent equal to the ANSI_STRING structure that is located at Address.

/msu
Sets the alias equivalent equal to the UNICODE_STRING structure that is located at Address.

Address
Specifies the location of the virtual memory that is used to determine the alias equivalent.

/x
Sets the alias equivalent equal to the 64-bit value of Expression.

Expression
Specifies the expression to evaluate. This value becomes the alias equivalent. For more information about the syntax, see Numerical Expression Syntax.

/f
Sets the alias equivalent equal to the contents of the File file. You should always use the /f switch together with aS, not with as.

File
Specifies the file whose contents become the alias equivalent. File can contain spaces, but you should never enclose File in quotation marks. If you specify an invalid file, you receive an "Out of memory" error message.

/c
Sets the alias equivalent equal to the output of the commands that CommandString specifies. The alias equivalent includes carriage returns if they are present within the command display and a carriage return at the end of the display of each command (even if you specify only one command).

CommandString
Specifies the commands whose outputs become the alias equivalent. This string can include any number of commands that are separated by semicolons.

Environment

Item Description
Modes User mode, kernel mode
Targets Live, crash dump
Platforms All

Additional Information

For more information about how to use aliases, see Using Aliases.

Remarks

If you do not use any switches, the as command uses the rest of the line as the alias equivalent.

You can end the aS command by a semicolon. This technique is useful in a script when you have to put all commands on a single line. Note that if the portion of the line after the semicolon requires expansion of the alias, you must enclose that second portion of the line in a new block. The following example produces the expected output, 0x6.

0:001> aS /x myAlias 5 + 1; .block{.echo myAlias}
0x6

If you omit the new block, you do not get the expected output. That is because the expansion of a newly set alias does not happen until a new code block is entered. In the following example, the new block is omitted, and the output is the text "myAlias" instead of the expected value 0x6.

0:001> aS /x myAlias 5 + 1; .echo myAlias
myAlias

For more information about using aliases in scripts, see Using Aliases.

If you use a /e, /ma, /mu, /msa, /msu, or /x switch, the as and aS commands work the same and the command ends if a semicolon is encountered.

If Name is already the name of an existing alias, that alias is redefined.

You can use the as or aS command to create or change any user-named alias. But you cannot use the command to control a fixed-name alias ($u0 to $u9).

You can use the /ma, /mu, /msa, /msu, /f, and /c switches to create an alias that contains carriage returns. However, you cannot use an alias that contains carriage returns to execute multiple commands in sequence. Instead, you must use semicolons.