This is more of an annoyance rather than a problem but I would very much like to understand the semantics here.
All I want to do is to run an arbitrary command on a temporary command-prompt session which itself running under a bash session.
My success rate is 50/50 as some command works as expected whereas others not so much.
I think the problem may lie around arguments not lining up properly (i.e. missing or merged arguments)
I'll try to explain what I mean by weird by a series of commands and responses. (I'm trying to get the word test to be printed on the screen.)
I'm running these under GNU bash, version 3.1.0(1)-release (i686-pc-msys) Bundled with Git-1.8.4:
First attempt:
$ cmd /c echo test
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
c:\>
Second attempt:
$ cmd '/c echo test'
test"
Third attempt:
$ cmd "/c echo test"
test"
Fourth attempt:
$ cmd /c\ echo\ test
test"
Fifth attempt:
$ cmd "/c echo" test
'echo" test' is not recognized as an internal or external command,
operable program or batch file.
I'd really appreciate any pointers or insights into the behaviors above as this is unintuitional to me and driving me crazy!
Edit: There is another question that appears similar to this, but it really isn't, mainly because it's about running batch files through CMD /C that doesn't require any arguments.
It doesn't really answer my question about how to provide arguments properly to windows command line apps, and even though the examples are about CMD /C, the answer here can be applied to many other Windows command line apps as well.