Take care copying commands from emails


Windows isn’t always WYSIWYG and sometimes it will pretend.


I’m talking here about how different characters are displayed on the screen to make the layout look nice. If you are typing away in Word then you can sometimes spot hyphens, for example, being changed in width on the fly. The text reads fine but you need to remember that the underlying character has a completely different ASCII/Unicode number. This becomes very important when copying text from an Office document or email into a script or the command line.


Examples include:


Single-quotes



The single-quote character – actually the apostrophe – (‘ 0x0027) can be exchanged with the left single-quote character ( 0x2018) and the right single-quote character ( 0x2019)


Double-quotes



The double-quote character (” 0x0022) can be exchanged with the left double-quote character ( 0x201C) and the right double-quote character ( 0x201D)


Hyphens



The hyphen-minus character (- 0x002D) can be exchanged with soft hyphens (-­ 0x00AD), hyphens (‐ 0x2010), en dashes (– 0x2013) or em-dashes (— 0x2014).


So if you have a command that won’t run without errors and it looks syntactically correct then just retype it with the keyboard – good chance it will start working.

Comments (2)

  1. In my job I often send my customers detailed instructions including things to run at the command line.

  2. John Gilham says:

    This happens all the time when pasting sharepoint STSADM.EXE commands from the web to the command prompt.  The work around is that you must retype all the hyphens from your pasted text.

    Thanks for explaining why this annoyance actaully occured.

    John