Не знаешь как, спроси у гугля set /p buf= < file echo %random%> file string path= @"C:SomeDirhta.txt"; string line; using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default)) { line = sr.ReadLine()} using (StreamWriter sw = new StreamWriter(зath, false, System.Text.Encoding.Default)) { sw.WriteLine(line);}