using alias parameters in window command prompt
- by freshWoWer
Source:http://jpsoft.com/help/index.htm?alias.htm
Aliases can use command line
parameters or parameters like those in
batch files. The command line
parameters are numbered from %0 to
%511. (%0 contains the alias name.)
For example, the following alias will
change directories, perform a command,
and return to the original directory:
alias in pushd %1 & %2$ & popd
when i run the above, my command prompt gives error saying
%1 * Unable to read value of alias *
'%2' is not recognized as an internal or external command,
operable program or batch file.
'popd`' is not recognized as an internal or external command,
operable program or batch file.
if you use double quote instead, alias in "pushd %1 & dir & popd"
it doesn't interprets the %1 when you execute the alias
C:\abc\defalias
Dumping all defined aliases for CMD.EXE.
in =pushd %1 & dir & popd
alias def wont work
---------EDIT------------
let me try some sample output with a simple echo alias
D:\abc\defalias /?
Usage: ALIAS [-v] [-p programName] [-f filespec] [ ]
[-v] means verbose output.
[-d] means delete aliases.
[-p programName] specifies which image file name these alias
definitions are for. Default is CMD.EXE
[-f filespec] specifies a file which contains the alises.
C:\Office\dev15alias out 'echo %1'
%1' * Unable to read value of alias *
C:\Office\dev15alias out backtick echo %1 backtick
%1` * Unable to read value of alias *
C:\Office\dev15alias out "echo %1"
C:\Office\dev15alias
Dumping all defined aliases for CMD.EXE.
out =echo %1
C:\Office\dev15out abc
%1
C:\Office\dev15alias out echo %1
%1 * Unable to read value of alias *
C:\Office\dev15out abc
ECHO is on.
Problem is,
both single quote and back tick produces error,
while double quote wont treat %1 as variable parameter