.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:

时间: 2024-10-15 00:32:25

.net 获取路径的相关文章

Java中获取路径的方法_自我分析

就目前的我来说最常用的两种获取路径的方法是  class.getRecource(filename) 和 class.getclassloader.getRecource(filename) 这两者的区别其实很简单就是路径的时候有点不同,这里主要讲两个参数,其他的路径获取,其他的话在根据相对路径逐一查找就行了 class.getRecource(filename): 参数"/" 表示获取根目录; (即我们常用到的bin目录[字节码文件存放的目录] " "  表示获取

JavaScript获取路径

1.设计源码 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JavaScript获取路径</title

工具:获取路径之间的相对路径

获取路径A和B的相对路径,目前有些bug,例如 A:E:\NewSvn\CommonHeader B:E:\NewSvn 得出..\..\NewSvn,总是再往上一层. github: https://github.com/xjp342023125/Code/trunk/Src/Test/GetRelativePath

Delphi 多文件拖放获取路径示例

unit Unit1; interface uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls, ShellAPI; type  TForm1 = class(TForm)    Memo1: TMemo;    procedure FormCreate(Sender: TObject);  private    // 当文件拖放至窗体中后,系统将向

【JAVA】关于java中 类.class.getResource(&quot;/&quot;).getPath()获取路径有空格的问题

写了一个web工程,在本地测试正确,但是部署到服务器上就出现错误.原因是读取不到配置文件. 后来从打印出来的文件路径中发现是用Java的class.getResource("/").getPath()获取路径的时候,路径中的空格转换成了%20. 在网上查询相关信息,果然将空格转成%20是一个古老的bug,我特意借此记录一下,希望能帮到遇到同样问题的朋友. Bug ID: 4466485 getClass( ).getResource( ).getFile( ) returns file

web应用路径问题(相对路径,绝对路径,动态获取路径)

1.相对路径和绝对路径 绝对路径:以 " / " 开头的路径,是完整的路径. 相对路径:不以 " / " 开头的路径,是相对于当前web资源目录的路径. 在绝对路径中, " / " 的含义有两种解释: (1)如果是服务器端解析, " / " 代表相对于当前web应用的绝对路径,即:协议名://服务器名(主机地址):端口号/项目名/,例如:http://localhost:8080/MyTest/. (2)如果是浏览器端解析(出

java ----获取路径的各种方法(总结)

Java Web开发中路径问题小结 (1) Web开发中路径的几个基本概念 假设在浏览器中访问了如下的页面,如图1所示: 那么针对这个站点的几个基本概念表述如下: 1. web站点的根目录:http://localhost:8080/ 2. web应用程序的的根目录:http://localhost:8080/test/ 3.同级目录:http://localhost:8080/test/articles/article1.jsp和http://localhost:8080/test/artic

jsp request 获取路径

这篇教程不错:http://zjutsoft.iteye.com/blog/1084260 自己试验如下: System.out.println("-----------------servlet-----------------"); System.out.println("realpath null:"+request.getRealPath("")); System.out.println("realpath index.jsp:

PHP获取路径或目录实现

<?php /**  * PHP获取路径或目录实现  */   //魔术变量,获取当前文件的绝对路径 echo "__FILE__: ========> ".__FILE__; echo '<br/>';   //魔术变量,获取当前脚本的目录 echo "__DIR__: ========> ".__DIR__; echo '<br/>';   //dirname返回路径的目录部分,dirname(__FILE__)相当于_

java中获取路径的几种方式

总是忘记, 备份一下,方便下次用. 第一种: File directory = new File("");//参数为空 String courseFile = directory.getCanonicalPath() ;System.out.println(courseFile); 结果:C:\Documents and Settings\Administrator\workspace\projectName获取当前类的所在工程路径; 第二种: File f = new File(th