Execute python command line from c# process start

NALB 71 Reputation points
2023-03-15T11:09:45.7966667+00:00

hello i have a command line that output data in Json file

my command line is like below

enum –json (amass.json) –d (domainname.com)

doing it like the below code won't result in JSON format only JSON file.

// start process
using var process = Process.Start(new ProcessStartInfo
{
    UseShellExecute = false
    FileName = "amass",
    RedirectStandardOutput = true,
    ArgumentList = { "enum","-json","amass.json", "-d", "test.com" }
});
// read std out
var output = process.StandardOutput.ReadToEnd();  
// wait for exit
process.WaitForExit();
// write out out
File.WriteAllText("~/FolderXTest/file.txt", output);

\

I even tried using it with bash but did not work .

I have another question , if my tool output folder not file how to implement that??

Developer technologies C#
{count} votes

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.