Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

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

Jan
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~
 
Here's another.

Code:
if %@ascii[%@right[1,%@execstr[1,setdos]]] != 126 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
 
Code:
setdos /c126
will do what you want, whether the command separator is already a swung dash or not.
 
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

Back
Top