var p = new System.Diagnostics.Process(); p.StartInfo.FileName = @"C:\Windows\System32\cmd.exe"; p.StartInfo.Arguments = "/c " + anyCommand; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.Start(); CSHARP var p = new System.Diagnostics.Process(); p.StartInfo.FileName = @"C:\Windows\System32\cmd.exe"; p.StartInfo.Arguments = "/c " + anyCommand; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.Start(); Есть такой кусок кода пишет при компиляции csc ошибка в var мол не найдено В самом Visual Studio Code ошибок нет Ошибка main.cs(16,5): error CS0246: Не удалось найти имя типа или пространства имен "var" (пропущена директива using или ссылка на сборку?)
https://translated.turbopages.org/p...could-not-be-found-in-wcf-service-application нашёл ответ вот если кому надо
using System; using System.Net; using System.IO; using System.Diagnostics; namespace ConsoleApp1 { public static void Main () { //кое какой код string anyCommand = @"кое какая команда "; var p = new System.Diagnostics.Process(); p.StartInfo.FileName = @"C:\Windows\System32\cmd.exe"; p.StartInfo.Arguments = "/c " + anyCommand; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.Start(); } } CSHARP using System; using System.Net; using System.IO; using System.Diagnostics; namespace ConsoleApp1 { public static void Main () { //кое какой код string anyCommand = @"кое какая команда "; var p = new System.Diagnostics.Process(); p.StartInfo.FileName = @"C:\Windows\System32\cmd.exe"; p.StartInfo.Arguments = "/c " + anyCommand; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.Start(); } }