home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- 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
- =============================================================================
-