TCC Quotes needed for Arguments containing '='?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
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
3,483
44
Albuquerque, NM
prospero.unm.edu
#3
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.
 
#4
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)?
 
#5
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
3,483
44
Albuquerque, NM
prospero.unm.edu
#6
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.
 
#7
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.
 
#10
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.