操作系统的环境变量存放在哪儿的呀?怎么样通过程序去得到

来源:互联网 发布:国外免费网络硬盘 编辑:程序博客网 时间:2024/04/29 02:50
GetEnvironmentVariable   
ExpandEnvironmentStrings   支护船体
SetEnvironmentVariable   
   
系统的  hkey_local_machine////system////currentcontrolset////control////settion   manager////environment   
当前用户的  hkey_current_user////environment

我把完整程序贴上来,有时间的话请在Turboc2里运行一下看看。
#include   //"stdio.h
#include   //"io.h//"   
#include   //"stdlib.h//"   
main()   
{   
    /*Define   variables*/   
    int   AccMode;   
    const   char   *EnvName   =   //"windir//";  
    char   *EnvValue;      
    /*Assign   default   value*/   
    AccMode   =   -1;   
    EnvValue   =   getenv(EnvName);      
    /*Print   Setup   title*/   
    printf(//"Will   setup   .Net   Framework...////n//");      
    /*Detect   if   there   is   .Net   Framework   v1.41   installed*/   
    access(EnvValue,AccMode);   
    printf(//"AccMode   is   %d////n//",AccMode);   
    printf(//"WINDIR   is   %s//",EnvValue);   
    if   (AccMode==0)   
        printf(//"There   is   c:////////windows//");   
  }   
 
原创粉丝点击