Computing.Net > Forums > Disk Operating System > PC-DOS variables read

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.

PC-DOS variables read

Reply to Message Icon

Name: E-ternal
Date: July 18, 2005 at 13:46:40 Pacific
OS: PC-DOS
CPU/Ram: ATHLON64
Comment:

How can I read a variables in PC-DOS?
Strangely things that work in MSDOS wont work in PC-DOS:

Set this=that
echo %this%

This works in Ms-Dos , but PC-Dos doesnt!?

Try it...

Anyone knows why?

I.love.scripting



Sponsored Link
Ads by Google

Response Number 1
Name: Rick McNabb
Date: July 18, 2005 at 16:12:30 Pacific
Reply:

Tried putting spaces around the = ??

Rule #1 Good computers don't go down.
Rule #2 There is no such thing as a good computer.


0

Response Number 2
Name: E-ternal
Date: July 18, 2005 at 21:35:47 Pacific
Reply:

Thanks, I tried it before, test it again...

but doesnt work either!

PC-DOS keeps echoing me "%this" instead of "that" Online sources say PC-DOS using the same syntax as MS-DOS for environmental variables though...

I.love.scripting


0

Response Number 3
Name: Nigel Spike
Date: July 19, 2005 at 01:00:31 Pacific
Reply:

The command SET will list all variables.

HTH
Nigel


0

Response Number 4
Name: wizard-fred
Date: July 19, 2005 at 03:03:25 Pacific
Reply:

Which version of each? When Microsoft and IBM split, each made different upgrades to DOS.


0

Response Number 5
Name: E-ternal
Date: July 19, 2005 at 04:02:07 Pacific
Reply:

Thanks Nigel, now I know at least the variable is set correct as it shows me the value when entering the SET command :)

Starting PC DOS...

PC DOS Version 7.00
(C)Copyright International Business Machines Corp 1981-1995.

A:\>SET X=Y
A:\>SET
PATH=
COMSPEC=A:\COMMAND.COM X=Y A:\>ECHO %X%
%X%

A:\>

I'm using IBM PC-DOS 7.0 and 7.0 2000

Thanks :)

I.love.scripting


0

Related Posts

See More



Response Number 6
Name: E-ternal
Date: July 19, 2005 at 04:05:17 Pacific
Reply:

Damn, the board screwed up the spaces, so I post the code again:


Starting PC DOS...

PC DOS Version 7.00
(C)Copyright International Business Machines Corp 1981-1995.

A:\>SET X=Y
A:\>SET
PATH=
COMSPEC=A:\COMMAND.COM
X=Y

A:\>ECHO %X%
%X%

A:\>

I.love.scripting


0

Response Number 7
Name: E-ternal
Date: July 19, 2005 at 06:00:25 Pacific
Reply:

Of course we still dont know how to read back X.... So what's the use of storing variables if you cant use them? Maybe I have to write IBM?

I.love.scripting


0

Response Number 8
Name: Nigel Spike
Date: July 19, 2005 at 07:23:27 Pacific
Reply:

Normally you use the variables to set up a program to start with certain parameters, not seldom hardware depending, or to "steer" a BAT file.

Assuming you are using a BAT file I think IF is what you are looking for.

http://www.computerhope.com/if.htm

Nigel


0

Response Number 9
Name: E-ternal
Date: July 19, 2005 at 08:10:20 Pacific
Reply:

No come on... it has to work I also did it in MS-DOS. Look at the following batch example and try it in your windows command (add choice.com to C:\) or real DOS:

@ECHO OFF
CLS
PATH=C:\
ECHO Settings Menu
ECHO ================
ECHO.
ECHO blah blah blah...?
ECHO.
ECHO.
ECHO [1] Option 1
ECHO [2] Option 2
ECHO.
ECHO.
ECHO Enter your choice:
ECHO.
CHOICE /C:12 >NUL

SET SRC=%ERRORLEVEL%


ECHO You have entered %SRC%

PAUSE >NUL


MS-DOS echos the correct value of the variable but in PC-DOS I cant seem to read it this way though it is stored. It seems that PC-DOS doesnt support Echo-ing a variable value. Besides...the IF statement doesnt work either, I tried that as well like:

SET X=Y
IF "%X%"=="Y" ECHO OK

...nothing is echoed by PC-DOS.

MS-DOS echoes OK!!

I.love.scripting


0

Response Number 10
Name: Nigel Spike
Date: July 19, 2005 at 08:55:38 Pacific
Reply:

Beats me since I haven't used PC-DOS since the late 80's, and my DOS machine only comes up from the basement a few times a year :)
Maybe this will help a bit.

Anyway good luck
Nigel


0

Response Number 11
Name: dtech10
Date: July 19, 2005 at 12:34:53 Pacific
Reply:

Hi
Try uppercase letters
SET THIS=THAT
ECHO %THIS%


0

Response Number 12
Name: jboy
Date: July 23, 2005 at 14:41:27 Pacific
Reply:

You example: set x=y works just fine under PC DOS 7.0 (Rev 0) - - and without the quotes or caps - - as a batch file.

Computers in the future may have only 1,000 vacuum tubes and perhaps only weigh 1 1/2 tons.


- Popular Mechanics, 1949


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: PC-DOS variables read

IBM PC DOS 7.00 Versus MS-DOS 6.22 www.computing.net/answers/dos/ibm-pc-dos-700-versus-msdos-622/9529.html

IBM PC DOS 1.00 / 1.10 Disk Confirm www.computing.net/answers/dos/ibm-pc-dos-100-110-disk-confirm/15851.html

Pc-dos 2000 = pc-dos 7? www.computing.net/answers/dos/pcdos-2000-pcdos-7/11511.html