0

I am executing a ruby script which takes command line arguments using C# code.
sc.rb holds the logic of Nessus API integration and yaml file is configuration file which is passed as argument.

Here is what I am currently doing :

System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo();

proc.FileName = @"C:\windows\system32\cmd.exe";
proc.Arguments = @"/c C:\\Users\\name\\Documents\\sc.rb --config Nessus.yaml";

This code doesn't work for sure. Is there any way I can specify command line arguments?

icebat
  • 4,696
  • 4
  • 22
  • 36

1 Answers1

0

You are using a literal string - e.g. the @ at the beginning but you are then escaping the slashes so it is doubling up the slash. Either omit double \ or the @

e.g.

System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo();

proc.FileName = @"C:\windows\system32\cmd.exe";
proc.Arguments = @"/c C:\Users\name\Documents\sc.rb --config Nessus.yaml";
Symeon Breen
  • 1,531
  • 11
  • 25