Shell command test

Successfully executed a shell command in C#
This commit is contained in:
FUH22860 2022-12-02 21:21:45 +01:00
commit 9c96f74f23
3 changed files with 28 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.vscode/
obj/
bin/

15
Program.cs Normal file
View 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
View 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>