I would like to start Internet Explorer as a different user through a command line alias. I liked the approach of using an AutoRun registry setting to call an environment setting script.
So I have an AutoRun registry key (REG_SZ) setup for HKCU\Software\Microsoft\Command Processor to execute an env.cmd file. The env.cmd file has one line in it: DOSKEY ieas=runas /user:user /netonly "C:\Program Files\Internet Explorer\iexplore.exe"
My question is whether there a way to write the DOSKEY command in the env.cmd file so that I can pass in the user name when I invoke ieas? I want to type: ieas MyDomain\SomeUser and have runas use MyDomain\SomeUser for the /user variable and prompt me for the specified account's password.
DOSKEY ieas=runas /user:$1 /netonly "C:\Program Files\Internet Explorer\iexplore.exe"
As per doskey /?
:
Edits command lines, recalls Windows commands, and creates macros.
DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
[/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename]
[macroname=[text]]
...
macroname Specifies a name for a macro you create.
text Specifies commands you want to record.
...
The following are some special codes in Doskey macro definitions:
$T Command separator. Allows multiple commands in a macro.
$1-$9 Batch parameters. Equivalent to %1-%9 in batch programs.
$* Symbol replaced by everything following macro name on command line.