How to? %_CMDLine not working the way I thought the documentation says it does...

May 24, 2010
Northlake, Il
As usual, a TCC session (and there's not much there):
  Wed  Feb 29, 2012  5:02:36p
TCC  13.03.46  Windows 7 [Version 6.1.7601]
[Z:\]type TestManualArgumentPassing.btm
@Echo %%_CMDLine: %_CMDLine
[Z:\]TestManualArgumentPassing abc def=ghi jkl
%_CMDLine: TestManualArgumentPassing abc
As you can easily see, only the name of the command and the first argument were output, everything after that was dropped.

Now, from the documentation, "_CMDLINE returns the current command line. (This is most useful in key aliases.) If you specify it on the command line, it returns the contents of the command line with the %_cmdline name removed."

I left the whole description in because I am not trying to use it the "most useful" way; specifically I want to pass stuff to a batch file that TCC's command line parsing for batch files destroys. (Just to be clear as to why I am trying to do this, when I wrote C++ programs in the past I almost always did "keyword" arguments in the format "/Keyword=value", and even though I've now switched to TCC batch files I'd like to maintain the same syntax because I want it to be totally "transparent" to the user (i.e., me) whether any give program is a C++ program or a batch file.

And the reason this is a problem for me is because for reasons Rex told me many moons ago had to do with cmd.exe compatibility TCC "strips" the "=" sign from the argument list as seen by the batch file; i.e. "abc def=ghi jkl" becomes just "abc def ghi jkl" as seen by the batch file. Well this is a problem because I also write these things such that not coding the parameter at all lets it take a "default" value if there is one, whereas coding the parameter with no value specified (i.e. "/Keyword=") "nulls" the value of the parameter, i.e. it has no value at all rather than the default value. And it seems to me (bad memory playing a role here) %_CMDLine used to return the entire command line rather than just the command name followed by only the first parameter. (I must admit that I can't even imagine a case where that would be useful.)

So what am I doing wrong? Is there any way just to get the command line exactly as it was entered?

- Dan
May 24, 2010
Northlake, Il
Thank you, guys. You are both correct (but %* is a little bit better because I then don't have to deal with the command name); and Rex, the fact that it's "%CMDLine: rather than "%_CMDLine" tells me that memory in the matter was only slightly bad. :)
Similar threads
Thread starter Title Forum Replies Date
R Emacs-style cmdline editing Ctrl-K Support 0
MickeyF expand alias in cmdline with Ctrl-F in TCC Support 21
MickeyF running a program from cmdline versus in batch file Support 1
H @XMLXPATH not working in v28 Support 0
twaterloo FolderMonitor for the 1st time not working Support 5
Tim Rowe NTFS Descriptions not working Support 13
J Batcomp still not working for me in TCMD27 Support 1
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
M Why did BEEP just quit working? Support 12
cgunhouse SETLOCAL not working in BDEBUGGER Support 9
nickles ANSI Colors Windows 7 no longer working Support 6
K ANSI Not Working Support 8
thorntonpg option /u not working The directory name is invalid Support 5
Charles Dye Is the "File Associations" installer dialog working? Support 4
H @ceiling @floor @int not working version 21.01.63 Support 9
K Command Line Selection Not Working Support 12
G Extended directory search not working Support 4
B %@fileseek is not working ? Support 2
C "Take Command has stopped working" Support 1
H New command not working well in Windows 7 Support 4
C "TakeCommand has stopped working" Support 3
N ping DNS lookup not working Support 1
N Updater/silentall not working? Support 1
K Help Not Working Support 11
R Fixed set /r has stopped working in build 35 Support 4
U Keys and IDX not working Support 11
Jesse Heines How to? Everything Tool Not Working After Version 20 Installation Support 8
WavSlave Fixed LIST /U not working in TCC v19 Support 5
Jay Sage %_selected no longer working Support 15
S iftp copying pgp files from ftp is not working Support 11 Extended Directory Searches are not working for me in CDD Support 9
J How to set working directory Support 10
vefatica Fixed LEAVE N not working Support 7
P %date5 not working Support 6
M WAD PDir not working correctly... Support 5
Detlef Fixed ParameterChar in TCMD.INI no longer working Support 35
Jay Sage WAD Variable _LOGFILE Not Working Support 2
I v16 - Shortcuts not working Support 6
rps Fixed Win "set /p" not working in V17 build 53 Support 3
Jay Sage Toolbar Update to INI File Not Working Support 10
Jay Sage Ctrl-C Not Working Reliably to Copy Screen Content Support 4
Jay Sage Unknown_CMD Not Working Support 4
fromano Fixed /E not working in TCMD 17.0.40 while doing one way synch Support 1
R WAD Copy's command dialogue not working Support 2
C WAD @index not working in v16 x64 Support 14
Dan Glynhampton Fixed @version "force" flag not working, and unable to set separator Support 3
C RSS feed subscription not working Support 9
M @Index not working like I thought it would... Support 2
C Working with links Support 6
C Move /MD not always working Support 1

Similar threads