Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

start command line from c#

using System;
using System.Diagnostics;

namespace runGnomeTerminal
{
    class MainClass
    {
        public static void ExecuteCommand(string command)
        {
            Process proc = new System.Diagnostics.Process ();
            proc.StartInfo.FileName = "/bin/bash";
            proc.StartInfo.Arguments = "-c " " + command + " "";
            proc.StartInfo.UseShellExecute = false; 
            proc.StartInfo.RedirectStandardOutput = true;
            proc.Start ();

            while (!proc.StandardOutput.EndOfStream) {
                Console.WriteLine (proc.StandardOutput.ReadLine ());
            }
        }

        public static void Main (string[] args)
        {
            ExecuteCommand("gnome-terminal -x bash -ic 'cd $HOME; ls; bash'");
        }


    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# float to string with 2 decimals 
Csharp :: how to delete from a list c# 
Csharp :: c# hex to console color 
Csharp :: c# stop loop 
Csharp :: unity get scrollbar value 
Csharp :: deltatime 
Csharp :: c# find one object in list where 
Csharp :: c# append multiline textbox 
Csharp :: c# for loop increment by 2 
Csharp :: c# bcrypt 
Csharp :: create char array c# 
Csharp :: casting string to enum type 
Csharp :: Attribute [livewire] does not exist. 
Csharp :: weighted random c# 
Csharp :: how to find a gameobject in unity 
Csharp :: unity normalize float 
Csharp :: c# 
Csharp :: read folder c# 
Csharp :: c# substring from end 
Csharp :: how set function when props update in vue 
Csharp :: increase timeout in .net core web app 
Csharp :: unity cos 
Csharp :: c# make request to rest api 
Csharp :: c# unity get name of object 
Csharp :: read embedded resource c# xml 
Csharp :: c# find all indexes 
Csharp :: c# onmousedown. unity 
Csharp :: c-sharp - get current page url/path/host 
Csharp :: httpwebrequest c# example 
Csharp :: 2 rotation unity 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =