TCC Quotes needed for Arguments containing '='?

Hi all,

I'm having a weird issue in TCC. I tried commands including equals signs, like e.g:
mvn -Denv=local​
This calls mvn.bat (Apache Maven), which launches a java process, using:
set MAVEN_CMD_LINE_ARGS=%*
"%JAVA_HOME%\bin\java.exe" ... %MAVEN_CMD_LINE_ARGS%
In the java process, the argument '-Denv=local' seems to be split, since it complains: 'Unknown lifecycle phase "local"'.

It works if I quote the argument:
mvn "-Denv=local"
This is quite annoying, and incompatible with e.g. bash or CMD.
Is there a workaround for this?

Grts, Geert.

PS: This still occurs in TC 16.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
On a related note, I tried checking the current behavior with a batch file:

Code:
@echo off
echo %%* = '%*'
echo %%1 = '%1'
echo %%2 = '%2'
echo %%3 = '%3'
echo %%4 = '%4'
echo %%5 = '%5'

The %1, %2, %3, etc. all worked as expected. But for some reason, the second line always displays a '*'. It seems that the trailing apostrophe prevents the expansion of the %*. Am I missing something obvious?

(Adding) This is not new behavior, by the way. It's unchanged since at least v13.
 
Sorry, but it is CMD that changed the rules years ago, the equal sign (=) became an argument separator. Lots of complaints back then, but we have come accustomed to the CMD style.
It works as expected in CMD (Win7): -Denv=dev is passed as a single argument to the java process.

Same holds for ',', eg 'mvn -pl alpha,beta' -> beta is interpreted as a separate argument in TCC, not in CMD.

Maybe it's just the %* expansion (used inside mvn.bat)?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Than again Microsoft may have changed back to the older syntax (at least in this instance). Backward compatibility is not only not high on Microsoft's priorities, it appears to be anathema. I do not use CMD, wouldn't have known years back that the change was made for CMD compatibility if not for the complaints.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
It works as expected in CMD (Win7): -Denv=dev is passed as a single argument to the java process.

Same holds for ',', eg 'mvn -pl alpha,beta' -> beta is interpreted as a separate argument in TCC, not in CMD.

Maybe it's just the %* expansion (used inside mvn.bat)?

So far as I can tell, CMD.EXE and TCC behave the same way. It might be helpful to add e.g.

Code:
set MAVEN_CMD_LINE_ARGS
pause

to your batch file after the variable is set, so you can check the value that the variable receives.
 
May 20, 2008
12,165
133
Syracuse, NY, USA
What about the semicolon? TCC doesn't use it as an arg delimiter; CMD does.
Code:
v:\> type echoargs.bat
@echo off
echo %*
echo %1
echo %2
echo %3
echo %4
Code:
v:\> ver & echoargs.bat a=b;c

TCC  16.00.36  Windows 7 [Version 6.1.7601]
a=b;c
a
b;c
ECHO is OFF
ECHO is OFF
Code:
v:\> ver & echoargs.bat a=b;c

Microsoft Windows [Version 6.1.7601]
a=b;c
a
b
c
ECHO is off.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I voted for CMD incompatibility long ago unless "Duplicate CMD bugs" is checked, when a quite different syntax would take over... Every year it will be more difficult to have two different syntaxes merged. The more features TCC the more likely CMD will come up with a conflicting syntax.
 
May 20, 2008
12,165
133
Syracuse, NY, USA
I'm not sure what you're arguing for here -- you want to eliminate include lists so you can use a semicolon as a batch delimiter?
It was just a comment on "CMD compatibility" ... a rather ill-defined notion that I'd be glad to do without.
 

Similar threads