I'm trying to download a file in the background of my application which I have got to work but I need help with how to know when it has finished downloaded and all the commands have executed.
I've tried using thread.sleep(5000) but of course every internet speed varies so is there a way to know?
Process cmd = new Process();
cmd.StartInfo.FileName = "cmd.exe"
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();
cmd.StandardInput.WriteLine("powershell");
cmd.StandardInput.WriteLine(@"wget 'https://www.example.com/file.exe'");
cmd.StandardInput.WriteLine(@"& 'file.exe'");
//wait until downloaded?
sendRequest();
Comments
Post a Comment