using System; using System.Diagnostics; class Program { static void Main() { string domainName = "40.79.186.186"; // 替换为您要查询的IP string nslookupResult = ExecuteNslookup(domainName); Console.WriteLine("Nslookup Result:"); Console.WriteLine(nslookupResult); } static string ExecuteNslookup(string domainName) { ProcessStartInfo startInfo = new ProcessStartInfo { FileName = "nslookup", Arguments = domainName, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true }; using (Process process = new Process { StartInfo = startInfo }) { process.Start(); string result = process.StandardOutput.ReadToEnd(); process.WaitForExit(); return result; } } }
标签:ProcessStartInfo,读取,domainName,C#,process,using,nslookup,string From: https://www.cnblogs.com/valu/p/18677816