Computing.Net > Forums > Disk Operating System > SET from a file?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

SET from a file?

Reply to Message Icon

Name: Blasterman
Date: November 19, 2007 at 19:25:19 Pacific
OS: MS-DOS 6.22
CPU/Ram: Pentium, 32 MB RAM
Product: Bochs 2.3.5
Comment:

I'd like to make a batch file that, at runtime, increments a counter set as an environment variable, and saves it in a file.

How can I do this? I'm using DOS 6.22.

All the OSes I use:
Windows XP, Windows 98, MS-DOS 6.22, OpenBSD 2.6, DLX Linux. I have 4 computers, one of which is emulated.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 20, 2007 at 04:26:27 Pacific
Reply:

AFAIK 6.22 has no provision for incrementing per se.

You might try something in debug. But it gets messy.



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: cup
Date: November 20, 2007 at 14:37:02 Pacific
Reply:

You could do something silly like this but it only goes from 0 to 9 and then back to 0 again.

Before you start

echo set snake=0 > snake.bat

The script

call setsnake
goto SS%snake%
:ss0
set snake=1
goto ssend
:ss1
set snake=2
goto ssend
:ss2
set snake=3
goto ssend
:ss3
set snake=4
goto ssend
:ss4
set snake=5
goto ssend
:ss5
set snake=6
goto ssend
:ss6
set snake=7
goto ssend
:ss7
set snake=8
goto ssend
:ss8
set snake=9
goto ssend
:ss9
set snake=0
:ssend
echo set snake=%snake% > setsnake.bat

snake.bat will contain the string that sets snake to the next number.


0

Response Number 3
Name: Blasterman
Date: November 20, 2007 at 18:49:57 Pacific
Reply:

Cup, I like your idea. I think I'll try it on my XP box. Thanks!


0

Response Number 4
Name: cup
Date: November 21, 2007 at 17:27:01 Pacific
Reply:

On NT/2K/XP, you have set /a for doing arithmetic. set /a doesn't exist on 6.22.


0

Response Number 5
Name: Blasterman
Date: November 23, 2007 at 15:27:56 Pacific
Reply:

On NT-based systems I use SET /A and /P a lot.

All the OSes I use:
Windows XP, Windows 98, MS-DOS 6.22, OpenBSD 2.6, DLX Linux. I have 4 computers, one of which is emulated.


0

Related Posts

See More



Response Number 6
Name: alexanrs
Date: November 23, 2007 at 19:19:07 Pacific
Reply:

If you use 4DOS, you can do something like this (... means other commands you want to execute):

SET var=0
...
SET var=%@inc[%var]
...
ECHO SET var=%var > SETVAR.BAT



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: SET from a file?

Set number of lines from a file to a var www.computing.net/answers/dos/set-number-of-lines-from-a-file-to-a-var/6487.html

Batch arguments from a file www.computing.net/answers/dos/batch-arguments-from-a-file/12457.html

Batch to get from a list in a file. www.computing.net/answers/dos/batch-to-get-from-a-list-in-a-file/14009.html