Why don't stsadm commands work when I copy/paste from an email?

Have you ever had someone send you an stsadm command via e-mail and it fails? If the answer is yes, then here's why.

When using Outlook, I typically have my formatting set to HTML. To check your formatting in Outlook 2010, select to compose a new message then click onthe "Format Text" tab at the top. There are three formatting options: HTML, Plain Text, and Rich Text. As you can see in the screenshot, HTML is selected.

What is actually happening is that the hypen is automatically being converted to an en dash because Microsoft Office is trying to "help" you with a prettier format on the hyphen. Per http://support.microsoft.com/kb/284897, "The AutoFormat rule assumes that spaces are used either before or on both sides of dashes, and that text appears after or on both sides of hyphens. Therefore, if a space appears before a hyphen, Word replaces the hyphen with an en dash. If text appears before a hyphen, Word makes no change." The article goes on to show how to change this default behavior.

To see the difference in the formatting of the hyphen, en dash, and em dash, open Word 2010, click the Insert tab and select Symbol from the Ribbon and then More Symbols

After selecting More Symbols, change the Subset to General Punctuation.

Notice the different Unicode (hex) values and a physical representation of how they appear in a document.

The following two screen shots show what happens to the hyphen before and after pressing the space bar

Bottom Line: If you want someone to be able to copy/paste stsadm commands from your email, change the formatting of the email to Plain Text.