- #@&cls&powershell "type '%~f0'|out-string|iex"&exit
- add-type @'
- using System;
- using System.IO;
- using System.Text;
- public static class test
- {
- public static void a(string i,string o)
- {
- using (FileStream fs = File.OpenWrite(o))
- {
- using (StreamReader sr = File.OpenText(i))
- {
- string s = "";
- while ((s = sr.ReadLine()) != null)
- {
- if(s.Length > 0)
- {
- //Console.WriteLine(s);
- Byte[] info =
- new UTF8Encoding(true).GetBytes(s.Split(' ')[3]+"\r\n");
- fs.Write(info, 0, info.Length);
- }
- }
- }
- }
- }
- }
- '@
- [test]::a('1.txt','2.txt')
复制代码 |