Thread: Win Console program environment variable

  1. #1
    Registered User
    Join Date
    May 2005

    Win Console program environment variable

    I'm trying to translate a UNIX C program to a Windows console program. Can anyone tell me how to set an environment variable in a console program? The UNIX function is setenv, and I find a Windows version SetEnvironmentVariable, but what about for a console program?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    There's nothing to prevent you from call SetEnvironmentVariable() from a console application.
    The MS run-time library supports _putenv() as well.


  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    you can also do it from the control panel in the System dialog. Click Advanced/Environment Variables
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Retrieving PATH Environment Variable
    By mercury529 in forum Windows Programming
    Replies: 9
    Last Post: 01-09-2007, 08:02 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Replies: 5
    Last Post: 04-10-2006, 03:03 PM
  4. how do i get the environment variable
    By Harman in forum C Programming
    Replies: 2
    Last Post: 05-09-2005, 10:51 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM