This may be a stupid question, but are the default aliases (e.g. cd) hardcoded in powershell or defined in a hidden "profile" script somewhere? I don't have any profiles set (per-user or system-wide) so I'm just wondering where the default ones come from.
A:
Though I do not know the technical details I would say they are hardcoded and they are not configurable. They can be redefined or removed but the initial set is not under our control.
Roman Kuzmin
2010-05-05 05:11:03
Which is a good thing, imho.
Joey
2010-05-05 09:06:48
+3
A:
Hardcoded, but retrievable (like most things "hidden" in powershell)
PS> [Management.Automation.Runspaces.InitialSessionState].getproperty(
"BuiltInAliases", [reflection.bindingflags]"NonPublic,Static").getvalue(
$null, @()) | format-table -auto
Definition Description Options CommandType Visibility Name PSSnapIn Module
---------- ----------- ------- ----------- ---------- ---- -------- ------
Add-Content ReadOnly, AllScope Alias Public ac
Add-PSSnapIn ReadOnly, AllScope Alias Public asnp
Clear-Content ReadOnly, AllScope Alias Public clc
Clear-Item ReadOnly, AllScope Alias Public cli
Clear-ItemProperty ReadOnly, AllScope Alias Public clp
Clear-Variable ReadOnly, AllScope Alias Public clv
...
;-)
x0n
2010-05-14 22:05:46
get-alias works too of course, but the above code is definitive regardless of other modules/snapins adding their own to the mix.
x0n
2010-05-14 23:22:22