How's the console c# doing dism?



  • Team 1 is carried out in powershell

    Dism /online /Get-FeatureInfo /FeatureName:TFTP
    

    In annex c#, nothing is done, console opens and nothing else happens:

    ProcStartargs("powershell",
                "-command \" Dism /online /Get-FeatureInfo /FeatureName:TFTP \"");
    

    public static void ProcStartargs(string name, string args)
    {
    try
    {
    var proc = new Process
    {
    StartInfo = new ProcessStartInfo
    {
    FileName = name,
    Arguments = args,
    UseShellExecute = false,
    RedirectStandardOutput = true,
    CreateNoWindow = true,
    StandardOutputEncoding = Encoding.GetEncoding(866)
    }
    };
    proc.Start();
    // ReSharper disable once NotAccessedVariable
    string line = null;
    while (!proc.StandardOutput.EndOfStream)
    {
    line += Environment.NewLine + proc.StandardOutput.ReadLine();
    }
    proc.WaitForExit();

            }
            catch (Exception ex)
            {
            }
        }
    

    Team 2 doesn't work either.

    ProcStartargs("powershell",
    "-command " Dism /Mount-Image/ ImageFile:d:\_images\install.wim /Index:1 /mountdir:d:\_images\_test "");



  • https://msdn.microsoft.com/ru-ru/library/hh825265.aspx - it's a separate program, not a team of powershell. Why let her through powershell something?




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2