How do i send CMD system commands from a windows form application?

Me 141 Reputation points
2022-06-11T04:01:05.107+00:00

Hello, i would like to know how to send system commands like taskkill or other commands with a press of a button from a windows form application.

Here is what i'm trying to do.

I have a roblox injector which executes scripts, but i want a button that does these commands:
taskkill /im robloxplayerlauncherbeta.exe /f
taskkill /im robloxplayerlauncher.exe /f
taskkill /im robloxstudio.exe /f
Here are screenshots of my button and my button's code.
210359-image.png
210387-image.png

Please give an answer.

Edit: im trying to do os.system, but it doesnt work.

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,521 Reputation points
    2022-06-11T07:11:17.59+00:00

    You can use Process.Start, like :

                    using (Process p = new Process())  
                    {  
                        p.StartInfo.FileName = "taskkill";  
                        p.StartInfo.Arguments = "/im notepad.exe /f";  
                        p.StartInfo.CreateNoWindow = true;  
                        p.StartInfo.UseShellExecute = false;  
                        p.Start();  
                    }  
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.