-1

this program is downloading videos... -o to custom save location

            var mainForm = Application.OpenForms.OfType<Form1>().Single();
            string urlBoxText2 = mainForm.Controls["URL_BOX"].Text;
            string text = "C:/Program Files/Sycho_DL/Downloader.exe -f 18 -o "C:\%(title)s.%(ext)s" ";
            string me2me = text + urlBoxText2;

            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = @"C:\Downloader.exe";
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.Arguments = me2me;
            Process process = new Process();
            process.StartInfo = startInfo;
            process.Start();
            process.WaitForExit();
  • Look at string text...Gives this error
  • why I can't put Double Quotes "" from start to end?
  • Note: the code will work if I typed it in txt file and used File. ReadAllText
  • I tried to make 'C:%(title)s.%(ext)s' with single quates but program won't download...
Sycho so
  • 13
  • 3
  • Double quotes are used to denote strings in C#. So if you need to use a double quote within a string, you need to escape it. If you research how to put a double quote in a C# string, you're sure to find helpful information. Make sure you adequately research your problem before asking a question here. – mason Feb 25 '22 at 03:50
  • It can't tell the difference between the double quotes that define the string and those within it. Escape them with ``\"`` or use a verbatim string (`@"Your text here"`). – Lance U. Matthews Feb 25 '22 at 03:50
  • @LanceU.Matthews (@"Your text here") this didn't work....... how to use \" ? – Sycho so Feb 25 '22 at 03:57

2 Answers2

0

To add double quotes in string c# is by doubling them. Example:

var someStr = "this is ""me""";
hndrbs
  • 1
0
string text = "C:/Program Files/Sycho_DL/Downloader.exe -f 18 -o  \"C:/%(title)s.%(ext)s\" ";

Fixed thanks.

Sycho so
  • 13
  • 3