Jump to content

Sign in to follow this  

BAT/CMD файлы. Перенаправление вывода

Recommended Posts

On 12/24/2020 at 1:24 PM, zombi said:

Windows :boredom:

как вариант напишите утилитку в .Net

 private string RunProcess(string proc_name, string proc_args)
            /* Create a new process object*/
            Process proc = new Process();
            /* StartInfo contains the startup information of the new process */
            proc.StartInfo.FileName = proc_name;
            proc.StartInfo.Arguments = proc_args;
            /* These two optional flags ensure that no DOS window appears */
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.CreateNoWindow = true;
            /* This ensures that you get the output from the DOS application */
            proc.StartInfo.RedirectStandardOutput = true;
                // Start the process
                // Wait that the process exits
                // Now read the output of the DOS application 
                return proc.StandardOutput.ReadToEnd().ToString();
            catch (Exception ex)
                return "Error: " + ex.Message; //ex.ToString();


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this