Skip to content

Commit 921b4be

Browse files
committed
Would not work if the YoutubeVIdeoDownloader folder was under a directory with a space in its name. Added quotes to the commands to fix.
1 parent b811796 commit 921b4be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

YoutubeVideoDownloader/MainWindow.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ private void DownloadVideo()
5151
{
5252
if (mp4.IsChecked == true)
5353
{
54-
Process.Start("cmd.exe", $"/k {fileName} --output \"{downloadsFolder}\" -f best " + $"\"{webLink.Text}\"");
54+
Process.Start("cmd.exe", $"/c '{fileName}' --output '{downloadsFolder}' -f best " + $"'{webLink.Text}'");
5555
}
5656

5757
if (mp3.IsChecked == true)
5858
{
59-
Process.Start("cmd.exe", $"/c {fileName} --output \"{downloadsFolder}\" -f best -x --audio-format mp3 \"{webLink.Text}\"");
59+
Process.Start("cmd.exe", $"/c '{fileName}' --output '{downloadsFolder}' -f best -x --audio-format mp3 '{webLink.Text}'");
6060
}
6161
}
6262
catch (Exception Ex)
@@ -69,7 +69,7 @@ private void OpenQualWin_Click(object sender, RoutedEventArgs e)
6969
{
7070
Process p = new Process();
7171
p.StartInfo.FileName = "cmd.exe";
72-
p.StartInfo.Arguments = $"/k {fileName} -F {webLink.Text}";
72+
p.StartInfo.Arguments = $"/k '{fileName}' -F '{webLink.Text}'";
7373
p.Start();
7474

7575
processID = p;
@@ -107,7 +107,7 @@ private void DownloadQuality()
107107
{
108108
Process p = new Process();
109109
p.StartInfo.FileName = "cmd.exe";
110-
p.StartInfo.Arguments = $"/c {fileName} -o \"{downloadsFolder}\" -f \"{qualityTextBox.Text}\" \"{webLink.Text}\"";
110+
p.StartInfo.Arguments = $"/c '{fileName}' -o '{downloadsFolder}' -f '{qualityTextBox.Text}' '{webLink.Text}'";
111111
p.Start();
112112
}
113113
}

0 commit comments

Comments
 (0)