Command line error caused by copy and paste

It's one of those moments that messes with your sanity. 

You need to run an stsadm command that is sufficiently complicated that you're tempted to copy and paste rather than to type just so that you can be sure not to fat finger it.   You paste the command into the command window, run it, and get the following "error":

Command line error.


           stsadm.exe -o <operation> [<parameters>]

           stsadm.exe -help [<operation>]



But you're certain that you've got the syntax right.  You have checked and double-checked and you know that you've got it right.  It shouldn't be erroring.  But it is. 

After trying it twenty times in different permutations, you start to wonder if it could have something to do with copying and pasting.  So you type it--and you type it exactly like it looks when you pasted it--and the command succeeds.   You proceed to wonder if you should rejoice that the mystery is solved or if you should curse yourself for not having become more suspicious of the copy and paste possibility earlier. 

This may not be all permutations of copy and paste of course.  It might be more apt to happen in multi-hop scenarios where I am copying from an the command window in an RDP console, pasting it to a particular chat window on my workstation, the customer I'm assisting then copies from the chat window on his or her side, and the customer then pasting it into a command prompt through yet another RDP session. 

Perhaps this combination creates some strange formatting problem.  The thing that drives me crazy is that its not something you can detect with the eye--at least I can't.  I've never debugged this kind of problem because I wrongly think that making a mental note to myself to never copy and paste an stsadm command again will somehow prevent me from doing it again.  (And a few months later I forget and have to re-learn this lesson.)


Comments (3)
  1. David Patrick says:

    I've had similar copy and paste issues, where some whitespace character, a tab maybe, was messing me up. I've also had it where a hyphen copied was not the same as a hyphen typed. I think it was a dash versus hyphen, as discussed here:…/stsadm-exe-copy-and-paste-command-line-error

  2. André Couture says:

    In my case, I was writing a tutorial in Word and the command I typed ended up with "smart quotes", which were then pasted into the command window and not recognized by FINDSTR. When I pasted it into Notepad++ and typed a quote beside it I saw it was different! With plain quotes, sanity returned.

    It may be interesting to note the smart quotes and normal quotes do not look any different in the command prompt, so there is no hint there.

  3. Christian Vega says:

    Hello, just had the same exact problem a few days ago.

    I saw your post and was almost giving up….

    The error is not a bug in the copy and paste

    For me it was in the value of the  minus  –  

    It was also the first time i had this problem always worked before.

    I had prepared my commands with excel and surprise when trying to copy them to my server they did not work

    I have solved this as follows

    copy the pasted command in the following site

    copy the typed command in the same site

    Check the ascii values differences

    The functionnal command must show ASCII value 45

    The pasted command showed ASCII value 150

    Once you know that, then you can change the ascii value of the Minus in the command

    This saved me "a lot" of work 🙂

    i share the info

Comments are closed.

Skip to main content