Shell command test
Successfully executed a shell command in C#
This commit is contained in:
commit
9c96f74f23
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.vscode/
|
||||||
|
obj/
|
||||||
|
bin/
|
15
Program.cs
Normal file
15
Program.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
Process process = new Process();
|
||||||
|
|
||||||
|
ProcessStartInfo processStartInfo = new ProcessStartInfo();
|
||||||
|
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||||
|
processStartInfo.FileName = @"ls";
|
||||||
|
processStartInfo.WorkingDirectory = @"/home/andre";
|
||||||
|
processStartInfo.Arguments = "--color";
|
||||||
|
processStartInfo.RedirectStandardOutput = false;
|
||||||
|
processStartInfo.RedirectStandardError = false;
|
||||||
|
processStartInfo.UseShellExecute = true;
|
||||||
|
|
||||||
|
process.StartInfo = processStartInfo;
|
||||||
|
process.Start();
|
10
update.csproj
Normal file
10
update.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user