- Jan
- 1,189
- 25
SETDOS /F is pushed/popped by SETLOCAL/ENDLOCAL.
I can find that in the help for SETLOCAL but not in the help for SETDOS /F.
I can find that in the help for SETLOCAL but not in the help for SETDOS /F.
By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!What about SETDOS /X? Are there new-fangled ways to turn off the special meanings of characters?SETDOS is obsolete (for about the last 25 years), and its documentation will never be updated.
What about SETDOS /X? Are there new-fangled ways to turn off the special meanings of characters?
User-contributed notes were a major feature of PHP's documentation and remain to this day. I was a PHP programmer for a few years, and I think it was the expandable documentation and the involvement of the user community that helped to give PHP the edge over other web languages like ASP and Cold Fusion.Blue-skying here: If users could attach comments to pages in the web help, and make them publicly viewable, then... you might have even more documentation.
Arent these things and the ability to disable them still very relevant? I use them in situations where I know no other way.The special meanings were for 4DOS, and have been deprecated forever for 4NT / TCC.
DO varname IN @file executes the commands between DO and ENDDO once for every line in file, setting varname to the content of each one in turn.
Beware of characters with special meaning to TCC, such as redirection and piping symbols, within the file (use SETDOS /X as needed).
SETLOCAL will save :
•the default disk drive and directory
•the environment,
•the alias list
•the user-defined function list
•The directory stack (PUSHD)
•the special character set (command separator, escape character, parameter character, decimal separator, and thousands separator)
•the SETDOS /X setting
•the SETDOS /F setting
You can disable aliases temporarily with the SETDOS /X command.
One way to overcome these potential problems is to use the SETDOS /X command to temporarily disable redirection symbols and other special characters. The two-line batch file above would be a lot more likely to produce the expected results if it were rewritten this way:
setdos /x-15678
input Enter a string: %%str
echo %str
setdos /x0
The first line turns off alias processing and disables several special symbols, including the command separator and all redirection symbols. Once the string has been processed, the last line re-enables the features that were turned off in the first line.
When manipulating strings returned by @FUNCTION you may need to disable certain special characters with SETDOS /X.
At this stage, any remaining Escape Characters are processed. However, this might also already have taken place inside some of the variable functions (such as @IF) that are likely to pass escaped strings in their parameters. If you are referencing one of those in an ECHO or similar command, you need to escape twice ("^^") or use SETDOS /X to avoid premature evaluation. Carefully test those situations to make sure the results are as you intended.
The example below uses TEXT to display or append to a file (specified as the optional parameter of the batch file):
@echo off
setlocal
setdos /x-6
set dest=%@if[%# GT 0,>> %1,]
setdos /x+6
set repeat=0
on error (unset dest & goto PROBLEM)
:PROBLEM
iff %repeat GT 1 then
echo Repeated problems - quitting
quit
endiff
set repeat=%@inc[%repeat]
text %dest
+----------------+
| Logical Drives |
+----------------+
endtext
subst %dest
echo. %dest
if %_transient eq 1 .and. %# EQ 0 pause
endlocal