{"id":8891,"date":"2007-01-06T10:19:00","date_gmt":"2007-01-06T10:19:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2007\/01\/06\/hyphens-in-command-names\/"},"modified":"2019-02-18T13:20:56","modified_gmt":"2019-02-18T20:20:56","slug":"hyphens-in-command-names","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/hyphens-in-command-names\/","title":{"rendered":"Hyphens in Command Names"},"content":{"rendered":"<p><!--\n \/* Font Definitions *\/\n @font-face\n\t{font-family:\"Cambria Math\";\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Cambria;\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Calibri;\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\n@font-face\n\t{font-family:\"Lucida Console\";\n\tpanose-1:2 11 6 9 4 5 4 2 2 4;}\n \/* Style Definitions *\/\n p.MsoNormal, li.MsoNormal, div.MsoNormal\n\t{margin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:.75in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nh2\n\t{mso-style-link:\"Heading 2 Char\";\n\tmargin-top:10.0pt;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:.75in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tpage-break-after:avoid;\n\tfont-size:13.0pt;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#4F81BD;\n\tfont-weight:bold;}\na:link, span.MsoHyperlink\n\t{color:blue;\n\ttext-decoration:underline;}\na:visited, span.MsoHyperlinkFollowed\n\t{color:purple;\n\ttext-decoration:underline;}\np\n\t{margin-right:0in;\n\tmargin-left:0in;\n\tfont-size:12.0pt;\n\tfont-family:\"Times New Roman\",\"serif\";}\np.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph\n\t{margin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:.5in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nspan.Heading2Char\n\t{mso-style-name:\"Heading 2 Char\";\n\tmso-style-link:\"Heading 2\";\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#4F81BD;\n\tfont-weight:bold;}\np.msolistparagraphcxspfirst, li.msolistparagraphcxspfirst, div.msolistparagraphcxspfirst\n\t{mso-style-name:msolistparagraphcxspfirst;\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:.5in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\np.msolistparagraphcxspmiddle, li.msolistparagraphcxspmiddle, div.msolistparagraphcxspmiddle\n\t{mso-style-name:msolistparagraphcxspmiddle;\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:.5in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\np.msolistparagraphcxsplast, li.msolistparagraphcxsplast, div.msolistparagraphcxsplast\n\t{mso-style-name:msolistparagraphcxsplast;\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:.5in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nspan.CodeChar\n\t{mso-style-name:\"Code Char\";\n\tmso-style-link:Code;\n\tfont-family:\"Lucida Console\";\n\tcolor:#EEEDF0;\n\tbackground:#012456;}\np.Code, li.Code, div.Code\n\t{mso-style-name:Code;\n\tmso-style-link:\"Code Char\";\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:12.0pt;\n\tmargin-left:.75in;\n\tline-height:115%;\n\tbackground:#012456;\n\tfont-size:8.0pt;\n\tfont-family:\"Lucida Console\";\n\tcolor:#EEEDF0;}\np.msopapdefault, li.msopapdefault, div.msopapdefault\n\t{mso-style-name:msopapdefault;\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:.75in;\n\tline-height:115%;\n\tfont-size:12.0pt;\n\tfont-family:\"Times New Roman\",\"serif\";}\n.MsoChpDefault\n\t{font-size:10.0pt;}\n@page Section1\n\t{size:8.5in 11.0in;\n\tmargin:1.0in 1.0in 1.0in 1.0in;}\ndiv.Section1\n\t{page:Section1;}\n--><\/p>\n<p>In my previous <a href=\"http:\/\/blogs.msdn.com\/powershell\/archive\/2007\/01\/06\/blog-your-initial-powershell-experiences.aspx\">blog entry<\/a>, I talked about how <strong>Michael Fisher<\/strong> had blogged his <a href=\"http:\/\/fastdad.wordpress.com\/2007\/01\/05\/windows-powershell-10\/\">intial impressions about PowerShell<\/a>.<\/p>\n<p>One of the things that Michael did not like was the hyphenated command names.&nbsp; A discussion about the Pros\/Cons of hyphens isn&#8217;t actionable at this point because we&#8217;ve placed our bets and shipped V1.&nbsp; Even if&nbsp;there was&nbsp;a compelling argument that convinced me of the errors of my ways, I wouldn&#8217;t be able to do anything about it.&nbsp;&nbsp;&nbsp; Changing would break compatibility.<\/p>\n<p>Now that isn&#8217;t to say, &#8220;take it or leave it&#8221;.&nbsp;&nbsp; No no no no.&nbsp; This is a <strong><em>customizable<\/em><\/strong> shell.&nbsp; In fact, it is an <em><strong>EASILY customizable<\/strong><\/em> shell.&nbsp; (There&#8217;s a difference between those 2).<\/p>\n<p>Michael &#8211; I encourage you to see if you can come to terms with the our hyphens.&nbsp; I&#8217;m told that everyone blanches the first time they taste Scotch but if&nbsp;you give it&nbsp;chance, you can grow a deep and profound appreciation for it.&nbsp; On the other hand, if you are like me and hate the stuff (me=&gt;Scotch, you=&gt;hyphenated commands) after repeated attempts to &#8220;see the magic&#8221;, all you need to do is to put the following line in your startup profile:<\/p>\n<p>Get-Command -Type Cmdlet | %{ Set-Alias ($_.Name -replace &#8220;-&#8221; ) $_.Name}<\/p>\n<p>Give that a try and see how you like it.&nbsp; If you want to see what is going on, just add a -Verbose to the Set-Alias: <\/p>\n<p class=\"Code\">PS&gt; Get-Command -Type Cmdlet |%{Set-Alias ($_.Name -Replace &#8220;-&#8220;) $_.Name -verbose}<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: AddContent Value: Add-Content&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: AddHistory Value: Add-History&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: AddMember Value: Add-Member&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: AddPSSnapin Value: Add-PSSnapin&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: ClearContent Value: Clear-Content&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: ClearItem Value: Clear-Item&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: ClearItemProperty Value: Clear-ItemProperty&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: ClearVariable Value: Clear-Variable&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: CompareObject Value: Compare-Object&#8221;.<br \/>VERBOSE: Performing operation &#8220;Set Alias&#8221; on Target &#8220;Name: ConvertFromBase64 Value: ConvertFrom-Base64&#8221;.<\/p>\n<p>&#8230;&#8230;.<\/p>\n<p>Be aware that if you write scripts using these aliases, you won&#8217;t be able to share them with other people and have them &#8220;just work&#8221;.&nbsp; That is the tension between customization and community.&nbsp; You are empowered to make your own decision about how to resolve that tension.&nbsp; <\/p>\n<p>Welcome to the&nbsp;community Michael &#8211; keep on blogging!&nbsp;<\/p>\n<p>Jeffrey Snover [MSFT]<br \/>Windows PowerShell\/MMC Architect<br \/>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a><br \/>Visit the Windows PowerShell ScriptCenter at:&nbsp; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous blog entry, I talked about how Michael Fisher had blogged his intial impressions about PowerShell. One of the things that Michael did not like was the hyphenated command names.&nbsp; A discussion about the Pros\/Cons of hyphens isn&#8217;t actionable at this point because we&#8217;ve placed our bets and shipped V1.&nbsp; Even if&nbsp;there was&nbsp;a [&hellip;]<\/p>\n","protected":false},"author":600,"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-8891","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>In my previous blog entry, I talked about how Michael Fisher had blogged his intial impressions about PowerShell. One of the things that Michael did not like was the hyphenated command names.&nbsp; A discussion about the Pros\/Cons of hyphens isn&#8217;t actionable at this point because we&#8217;ve placed our bets and shipped V1.&nbsp; Even if&nbsp;there was&nbsp;a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/8891","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\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=8891"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/8891\/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=8891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=8891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=8891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}