home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / alt / msdos / programm / 3109 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  1.8 KB

  1. Path: sparky!uunet!utoday!jaflrn!jaf
  2. From: Jon Freivald <jaf@jaflrn.UUCP>
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: Help Required with Dos variables
  5. Message-ID: <L6eZwB1w164w@jaflrn.UUCP>
  6. Date: Wed, 06 Jan 93 19:56:56 EST
  7. References: <1993Jan4.160029.26833@newton.ccs.tuns.ca>
  8. Organization: The Wizzard's Cave, East Meadow, NY
  9. Lines: 42
  10.  
  11. macdonak@newton.ccs.tuns.ca (Kevin MacDonald) writes:
  12.  
  13. > Is there any way to display the contents of a single DOS variable?
  14. > I know you can display all current variables by typing SET, but there
  15. > doesn't appear to be any way to display variables individually.
  16. > I'm trying to setup a user log for our novell server and I thought
  17. > since the users login time and username can be stored in dos
  18. > variables, the simplest way to accomplish what I want to do would be 
  19. > to redirect the contents of these variables to a file... but alas
  20. > DOS doesn't seem to want to cooperate...
  21. > Rob
  22.  
  23. You don't specify what exactly you want to do, but here's a couple
  24. examples: (We'll assume you're after the contents of a variable named
  25. "USER")
  26.  
  27. DOS batch file:
  28.  
  29.     echo %%USER%% > logfile
  30.          -or-
  31.     echo %USER% > logfile
  32.  
  33. Using one or two '%' is DOS version and command interpreter dependent -
  34. experiment -- mostly I use the single until I find a place it barfs,
  35. then add the other...
  36.  
  37. C (Turbo to be specific - check your library reference)
  38.  
  39.     char user_var[20];     /* whatever length...? */
  40.     user_var = getenv("USER");
  41.  
  42. Hope this helps...
  43.  
  44. Jon
  45.  
  46. =============================================================================
  47.                    Jon Freivald ( jaf%jaflrn@uunet.UU.NET )
  48.      Nothing is impossible for the man who doesn't have to do it.
  49.             PGP V2 public key available on request
  50. =============================================================================
  51.