🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1085

Re: Help Required with Dos variables

#1085
From: Jon Freivald
Date: Thu, 07 Jan 1993 00:56
42 lines
1871 bytes
macdonak@newton.ccs.tuns.ca (Kevin MacDonald) writes:

> Is there any way to display the contents of a single DOS variable?
> I know you can display all current variables by typing SET, but there
> doesn't appear to be any way to display variables individually.
> 
> I'm trying to setup a user log for our novell server and I thought
> since the users login time and username can be stored in dos
> variables, the simplest way to accomplish what I want to do would be 
> to redirect the contents of these variables to a file... but alas
> DOS doesn't seem to want to cooperate...
> 
> Rob

You don't specify what exactly you want to do, but here's a couple
examples: (We'll assume you're after the contents of a variable named
"USER")

DOS batch file:

    echo %%USER%% > logfile
         -or-
    echo %USER% > logfile

Using one or two '%' is DOS version and command interpreter dependent -
experiment -- mostly I use the single until I find a place it barfs,
then add the other...

C (Turbo to be specific - check your library reference)

    char user_var[20];     /* whatever length...? */
    user_var = getenv("USER");

Hope this helps...

Jon

=============================================================================
                   Jon Freivald ( jaf%jaflrn@uunet.UU.NET )
	 Nothing is impossible for the man who doesn't have to do it.
		    PGP V2 public key available on request
=============================================================================
Technical Details
Message-ID: <L6eZwB1w164w@jaflrn.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!utoday!jaflrn!jaf
References: <1993Jan4.160029.26833@newton.ccs.tuns.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!utoday!jaflrn!jaf
From: Jon Freivald <jaf@jaflrn.UUCP>
Newsgroups: alt.msdos.programmer
Subject: Re: Help Required with Dos variables
Message-ID: <L6eZwB1w164w@jaflrn.UUCP>
Date: Wed, 06 Jan 93 19:56:56 EST
References: <1993Jan4.160029.26833@newton.ccs.tuns.ca>
Organization: The Wizzard's Cave, East Meadow, NY
Lines: 42