My scenario is simple - I am copying script samples from the Mercurial online book and pasting them in a Windows command prompt. The problem is that the samples in the book use single quoted strings. When a single quoted string is passed on the Windows command prompt, the latter does not recognize that everything between the single quotes belongs to one string.
For example, the following command:
hg commit -m 'Initial commit'
cannot be pasted as is in a command prompt, because the latter treats
'Initial commit' as two strings -
commit'. I have to edit the command after paste and it is annoying.
Is it possible to instruct the Windows command prompt to treat single quotes similarly to the double one?
Following the reply by JdeBP I have done a little research. Here is the summary:
Mercurial entry point looks like so (it is a python program):
def run(): "run the command in sys.argv" sys.exit(dispatch(request(sys.argv[1:])))
So, I have created a tiny python program to mimic the command line processing used by mercurial:
import sys print sys.argv[1:]
Here is the Unix console log:
[hg@Quake ~]$ python 1.py "1 2 3" ['1 2 3'] [hg@Quake ~]$ python 1.py '1 2 3' ['1 2 3'] [hg@Quake ~]$ python 1.py 1 2 3 ['1', '2', '3'] [hg@Quake ~]$
And here is the respective Windows console log:
C:\Work>python 1.py "1 2 3" ['1 2 3'] C:\Work>python 1.py '1 2 3' ["'1", '2', "3'"] C:\Work>python 1.py 1 2 3 ['1', '2', '3'] C:\Work>
One can clearly see that Windows does not treat single quotes as double quotes. And this is the essence of my question.