How to? How can I say "if the command separator is not ~ then setdos /C~"

Jan 16, 2011
15
0
If someone using one of my scripts happens to have the command separator set to, say, ~ then when my script says
setdos /C~ the response is The parameter is incorrect. "/C" because the ~ already is the command separator.

Since the %+ pseudovariable is no longer supported, how can I say "if the command separator is not ~ then setdos /C~"
 
This is crude. I suspect there will be better ones.

Code:
if "%@execstr[echos * ~ echos *]" != "**" setdos /c~
 
"%+" may not be supported, or work in all situations, but it works in this situation (TCC 26.02.42). Of course, that may change without warning.

Code:
v:\> if "%+" != "~" echo ~ is not the command separator
~ is not the command separator
 
It doesn't get more elegant than that. Where did you find that one, Charles?
Wait, that isn't documented?

I guess I know about it because I was the one who originally requested it, umpteen years ago. It works with /E and /P too, and you can use hexadecimal if you prefer:
Code:
setdos /c0x7e
 

Similar threads