If you're looking to take the next step in FreeDOS, here's a handy quick reference guide to batch programming.
DOS batch programs are simple scripts that "batches up" several commands into one file. Batch programs have some basic flow control that you can use to do loops and jump to different segments of the program. In batch programs, reference variable values by enclosing the variable name with
%, such as %PATH%| What do you want to do? | How to do it in a batch program: |
|---|---|
| Execute another batch script from within a script | CALL SCRIPT.BAT |
| Run a command for each file in a list | FOR %%F IN (*.TXT) DO EDIT %%For at the command line: C:\> FOR %F IN (*.TXT) DO EDIT %FThe loop variable name can only be one character. |
| Print a message | ECHO Hello world |
| Jump to a label in a batch file | :LOOP |
| Test the value of a string | IF %VAR%==Y ECHO Yes |
| Test if a file exists | IF EXIST TEMP.DAT DEL TEMP.DAT |
| Test the return value of the previous command | IF ERRORLEVEL 0 ECHO Success |
| Test the opposite | IF NOT ERRORLEVEL 0 ECHO Fail |
| Set the shell's search path for programs | PATH C:\FDOS\BIN;C:\MY\BINor to reference the existing path: PATH %PATH%;C:\MY\BINUse ; to separate paths. |
| Set a variable | SET TEMPFILE=TEMP.DAT |
| Shift the command line options | SHIFT or SHIFT 1 or any nReference command line options as %1, %2, and so on. |
| A comment | REM This is a comment |

Very useful. Thanks.
ReplyDeletevery nice, would be cool, if there a "search a string in the text.txt and change the value behind "[this entry]" \n settings=blabla to settings=totalokey "
ReplyDeletethis could be helpful in autoexec/config or other textfiles
best
You are describing steam editing. You can do some of that using edlin. Or you can use GNU awk from the gnuish utilities to do exactly what you describe. In gawk, it's pretty straightforward to detect a string in a file, use that as a marker to modify a matching line that follows. You can get gawk here:
ReplyDeletehttp://www.ibiblio.org/pub/micro/pc-stuff/freedos/gnuish/