textBox1.Text=Path.GetTempFileName(); FileInfo fi = new FileInfo(textBox1.Text); StreamWriter sw = fi.AppendText(); sw.Write("临时文件"); sw.Close();