MS DOS

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Store output of Dos command in a variable

    4 answers - 302 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit


    Hi,
    Does anyone know of a way to store the output of a DS command to a
    variable.
    type file.txt %var%
    I want the value of variable %var% to be the output of the 'type file.txt'
    command.
    I tried redirecting the output with | and but no luck.
    Thanks,
  • No.1 | | 739 bytes | |


    If you have the original DS (scriptable) line editor or SED or PERL:

    Put the output into a file, edit the file as a batch file and
    run the batch file.

    pipe commands go to files, not variables

    only on Burroughs machines did I ever see variables and files be
    interchangeable (on B7900 ALGL a file was an araay and an array was a file)

    - = -
    Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
    BachMozart ReaganQuayle EvrytanoKastorian

    {Nothing herein constitutes advice. Everything fully disclaimed.}
    [Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]
    [Homeland Security means private firearms not lazy obstructive guards]

  • No.2 | | 769 bytes | |

    JRS: In article <-YKdnaqwKY32PGveRVn-pQ@comcast.com>, dated Fri, 17 Feb
    2006 22:26:59 remote, seen in news:alt.msdos.programmer, Al Wilkerson
    <ac527@comcast.netposted :
    >Does anyone know of a way to store the output of a DS command to a
    >variable.
    >
    >type file.txt %var%
    >
    >I want the value of variable %var% to be the output of the 'type file.txt'
    >command.


    type file.txt | STW var

    will store the first line. STW via sig line 3 below.

    If you cannot use imports, you can use QBasic to generate from file.txt
    another file $$$.bat containing set var=FirstLine and then
    execute that.

    It's just possible that an EDLIN script could do it too.
  • No.3 | | 106 bytes | |

    Al Wilkerson wrote:
    Does anyone know of a way to store the output of a DS command
    to a variable?
  • No.4 | | 530 bytes | |

    Thanks to all, I found a way to do what I need, just using the standard FR
    loop.

    Al
    "Richard Bonner" <ak621@chebucto.ns.cawrote in message
    news:dt9tnj$gjq$5@News.Dal.Ca
    Al Wilkerson wrote:
    >
    >Does anyone know of a way to store the output of a DS command
    >to a variable?
    >--
    >Al
    >

    XSET can do that. A link is at:

    http://www.chebucto.ca/~ak621/DS/Websites.html

    Richard Bonner
    http://www.chebucto.ca/~ak621/DS/

Re: Store output of Dos command in a variable


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "MS DOS"

EMSDN.COM