Maybe you should try an intermediate fix of your last loop:
. . .
while (line != null)
{
XtraMessageBox.Show(line);
line = outputWriter.ReadLine(); // ADDED
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
good afternoon -
been trying for a while now to get my argements passed to cmd i know it uses only one string arguments so i done a string join
public void searchartist(string search)
{
if (search == string.Empty)
{
XtraMessageBox.Show("Please Provide search term ");
}
else
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "cmd.exe";
string[] myargs = { "/c spotdl download ", "'", search, "'" };
string elfen = string.Join("", myargs);
XtraMessageBox.Show(elfen);
p.StartInfo.Arguments = string.Join("",elfen);
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
StreamReader outputWriter = p.StandardOutput;
//String errorReader = p.StandardError.ReadToEnd();
String line = outputWriter.ReadLine();
while (line != null)
{
XtraMessageBox.Show(line);
}
p.WaitForExit();
}
}
the string join shows,
however this is not working well its just showing in the line
Searching Spotify for song named "download"...
but have no idea why its doing this when the arg passed is one string
any help would be much appreiated
elfenliedtopfan5
Maybe you should try an intermediate fix of your last loop:
. . .
while (line != null)
{
XtraMessageBox.Show(line);
line = outputWriter.ReadLine(); // ADDED
}