2009-02-26 2 views

答えて

43

は(通常は)Cを返します

Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)); 

を試してみてください。これは、Windowsがインストールされているドライブを提供します。

1
var d = Directory.GetDirectoryRoot(Environment.GetEnvironmentVariable("windir")); 
2

hereから盗まEnvironment.GetFolderPath(Environment.SpecialFolder.System).Substring(0,1)

1

"SystemDrive"は、XPの環境変数です。

11

これは動作するはずです(あなたは窓が上にあるドライブをしたいと仮定します):

string rootDrive = Path.GetPathRoot(Environment.SystemDirectory);