- May
- 13,215
- 180
I've been having a lot of trouble with back quotes on the command line not doing what I expect and I keep getting the feeling that they don't work like they have for many years. Maybe I shouldn't have to ask this but ...
The help says
I use this line in several BTMs and it works.
If I use it at a command line, it doesn't work.
And the example from the "Quoting" page in the help doesn't work as that page says.
The help says I should see (and I kinda expect to see)
What's going on?
The help says
No alias or variable expansion is performed on a parameter enclosed in back quotes. Redirection symbols inside the back quotes are ignored. The back quotes are removed from the command line before the command is executed.
I use this line in several BTMs and it works.
Code:
function tformat `%@instr[0,4,%1]-%@instr[4,2,%1]-%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1].%@instr[15,3,%1]`
If I use it at a command line, it doesn't work.
Code:
v:\> function tformat `%@instr[0,4,%1]-%@instr[4,2,%1]-%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1].%@instr[15,3,%1
]`
v:\> function tf*
tformat=-- ::.
And the example from the "Quoting" page in the help doesn't work as that page says.
Code:
v:\> type quotes.bat
@echo off
echo Arg1 = %1
echo Arg2 = %2
echo Arg3 = %3
v:\> set forvar=for
v:\> quotes `Now is the time %forvar` all good
Arg1 = Now
Arg2 = is
Arg3 = the
The help says I should see (and I kinda expect to see)
Code:
Arg1 = Now is the time %forvar
Arg2 = all
Arg3 = good
What's going on?
Last edited: