.net 获取路径

1. Environment.GetFolderPath(Environment.SpecialFolder)
Environment.SpecialFolder.ApplicationFolder即为Roaming文件夹的路径
2. Environment.GetEnvironmentVariable(string)
可遍历支持的类型:
foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
                {
                    Console.WriteLine("  {0} = {1}", de.Key, de.Value);
                }
类型:
 
Path = D:\Program Files\Sun\OPhone SDK\tools;D:\Program Files\Sun\android-sdk-windows-1.5_r2\tools;D:\Program
 
Files\Sun\SDK\jdk\bin;D:\Program Files\Sun\SDK\jdk\jre\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program
 
Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program
 
Files\Microsoft SQL Server\90\Tools\binn\;D:\Program Files\CodeSmith\v5.0\;D:\Program Files\Symantec\pcAnywhere\;C:\Program
 
Files\Ixia\IxChariot;D:\Program Files\Sun\SDK\bin;
  TEMP = C:\DOCUME~1\gmj\LOCALS~1\Temp
  SESSIONNAME = Console
  PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
  USERDOMAIN = EVER62
  PROCESSOR_ARCHITECTURE = x86
  SystemDrive = C:
  APPDATA = C:\Documents and Settings\gmj\Application Data
  JSERV = E:\oracle\ora92/Apache/Jserv/conf
  windir = C:\WINDOWS
  _ACP_INCLUDE = D:\Program Files\Microsoft Visual Studio 8\VC\include;D:\Program Files\Microsoft Visual Studio 8
 
\VC\atlmfc\include;D:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include;D:\Program Files\Microsoft Visual Studio 8
 
\SDK\v2.0\include
  TMP = C:\DOCUME~1\gmj\LOCALS~1\Temp
  USERPROFILE = C:\Documents and Settings\gmj
  ProgramFiles = C:\Program Files
  FP_NO_HOST_CHECK = NO
  HOMEPATH = \Documents and Settings\gmj
  COMPUTERNAME = EVER62
  _ACP_PATH = D:\Program Files\Microsoft Visual Studio 8\VC\bin;D:\Program Files\Microsoft Visual Studio 8
 
\VC\PlatformSDK\bin;D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;D:\Program Files\Microsoft Visual Studio 8
 
\Common7\tools;D:\Program Files\Microsoft Visual Studio 8\Common7\ide;C:\Program Files\HTML Help Workshop;D:\Program
 
Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;D:\Program Files\Microsoft Visual
 
Studio 8\;D:\Program Files\Microsoft Visual Studio 8\\SDK\v2.0\bin;C:\WINDOWS\SysWow64;D:\Program Files\Microsoft Visual Studio
 
8\Team Tools\Static Analysis Tools\FxCop\;D:\Program Files\Sun\OPhone SDK\tools;D:\Program Files\Sun\android-sdk-windows-1.5_r2
 
\tools;D:\Program Files\Sun\SDK\jdk\bin;D:\Program Files\Sun\SDK\jdk\jre\bin;E:\oracle\ora92\bin;C:\Program
 
Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32
 
\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\Program Files\CodeSmith\v5.0
 
\;D:\Program Files\Symantec\pcAnywhere\;C:\Program Files\Ixia\IxChariot;D:\Program Files\Sun\SDK\bin;
  USERNAME = gmj
  NUMBER_OF_PROCESSORS = 2
  PROCESSOR_IDENTIFIER = x86 Family 6 Model 23 Stepping 6, GenuineIntel
  _ACP_LIB = D:\Program Files\Microsoft Visual Studio 8\VC\lib;D:\Program Files\Microsoft Visual Studio 8
 
\VC\atlmfc\lib;D:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\i386;D:\Program Files\Microsoft Visual Studio 8
 
\VC\PlatformSDK\lib;D:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;D:\Program Files\Microsoft Visual Studio 8
 
\;D:\Program Files\Microsoft Visual Studio 8\lib
  WecVersionForRosebud.DA8 = 2
  SystemRoot = C:\WINDOWS
  ComSpec = C:\WINDOWS\system32\cmd.exe
  LOGONSERVER = http://www.cnblogs.com/xinyuxin912/***
  VS80COMNTOOLS = D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
  _ACP_ATLPROV = D:\Program Files\Microsoft Visual Studio 8\VC\Bin\ATLProv.dll
  WV_GATEWAY_CFG = E:\oracle\ora92\Apache\modplsql\cfg\wdbsvr.app
  CommonProgramFiles = C:\Program Files\Common Files
  PROCESSOR_LEVEL = 6
  PROCESSOR_REVISION = 1706
  CLIENTNAME = Console
  ALLUSERSPROFILE = C:\Documents and Settings\All Users
  VS90COMNTOOLS = D:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
  OS = Windows_NT
  HOMEDRIVE = C:

 

posted @ 2017-08-25 12:53  sunlyk  阅读(388)  评论(0编辑  收藏  举报