System.IO名前空間のPathクラスを利用することで一時保存フォルダを取得する事が出来ます。
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Dim tempDirPath As String = System.IO.Path.GetTempPath() ' 単純に環境変数から一時保存フォルダパスを取得するが ' フォルダが存在するかどうかは分からないのでチェックはする If (Not System.IO.Directory.Exists(tempDirPath)) Then Console.WriteLine("一時保存フォルダがありません") End If End Sub
private void Button1_Click(System.Object sender, System.EventArgs e) { string tempDirPath = System.IO.Path.GetTempPath(); // 単純に環境変数から一時保存フォルダパスを取得するが // フォルダが存在するかどうかは分からないのでチェックはする if (!System.IO.Directory.Exists(tempDirPath)) { Console.WriteLine("一時保存フォルダがありません"); } }
MSDNライブラリをみると.NET Compact Framerworでも使えるみたい。ちなみにWindows Mobile 6.5 VGAエミュレータで実行すると、取得した一時保存フォルダパスは「\Application Data\Volatile\」でした。