{"id":17642,"date":"2007-06-28T11:25:27","date_gmt":"2007-06-28T19:25:27","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17642"},"modified":"2019-05-16T11:28:18","modified_gmt":"2019-05-16T19:28:18","slug":"do-you-really-want-to-use-eq","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/do-you-really-want-to-use-eq\/","title":{"rendered":"Do You Really Want To Use &ndash;EQ?"},"content":{"rendered":"<p>Sebastien posted a cool simple script HERE which effectively does a reverse lookup on aliases. Here is the code: \nfunction Get-AliasShortcut([string]$CommandName) {\nls Alias: | ?{ $_.Definition -eq $CommandName }\n}\nSet-Alias gas Get-AliasShortcut\nNotice that he used \u2013EQ. Whenever you find yourself using \u2013EQ, ask yourself if that is really want you want. You might be cheating yourself out of a ton great stuff. Consider changing the -EQ to -MATCH\nThat would allow you to do:\nPS> Get-AliasShortcut child<\/p>\n<p>CommandType Name Definition\n&#8212;&#8212;&#8212;&#8211; &#8212;- &#8212;&#8212;&#8212;-\nAlias gci Get-ChildItem\nAlias ls Get-ChildItem\nAlias dir Get-ChildItem<\/p>\n<p>PS> Get-AliasShortcut item<\/p>\n<p>CommandType Name Definition\n&#8212;&#8212;&#8212;&#8211; &#8212;- &#8212;&#8212;&#8212;-\nAlias cli Clear-Item\nAlias clp Clear-ItemProperty\nAlias cpi Copy-Item\nAlias cpp Copy-ItemProperty\nAlias gci Get-ChildItem\nAlias gi Get-Item\nAlias gp Get-ItemProperty\nAlias ii Invoke-Item\nAlias mi Move-Item\nAlias mp Move-ItemProperty\nAlias ni New-Item\nAlias ri Remove-Item\nAlias rni Rename-Item\nAlias rnp Rename-ItemProperty\nAlias rp Remove-ItemProperty\nAlias si Set-Item\nAlias sp Set-ItemProperty\nAlias cp Copy-Item\nAlias ls Get-ChildItem\nAlias mv Move-Item\nAlias rm Remove-Item\nAlias rmdir Remove-Item\nAlias copy Copy-Item\nAlias del Remove-Item\nAlias dir Get-ChildItem\nAlias erase Remove-Item\nAlias move Move-Item\nAlias rd Remove-Item\nAlias ren Rename-Item\nSebastien \u2013 thanks for the cool script!\nJeffrey Snover [MSFT]\nWindows Management Partner Architect\nVisit the Windows PowerShell Team blog at: http:\/\/blogs.msdn.com\/PowerShell\nVisit the Windows PowerShell ScriptCenter at: http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sebastien posted a cool simple script HERE which effectively does a reverse lookup on aliases. Here is the code: function Get-AliasShortcut([string]$CommandName) { ls Alias: | ?{ $_.Definition -eq $CommandName } } Set-Alias gas Get-AliasShortcut Notice that he used \u2013EQ. Whenever you find yourself using \u2013EQ, ask yourself if that is really want you want. You [&hellip;]<\/p>\n","protected":false},"author":685,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17642","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Sebastien posted a cool simple script HERE which effectively does a reverse lookup on aliases. Here is the code: function Get-AliasShortcut([string]$CommandName) { ls Alias: | ?{ $_.Definition -eq $CommandName } } Set-Alias gas Get-AliasShortcut Notice that he used \u2013EQ. Whenever you find yourself using \u2013EQ, ask yourself if that is really want you want. You [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/685"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17642"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17642\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}