If your question is about downloading and applying a registry file silently, I have coded this method in C#: Code: /* * DownloadAndInstallRegFile C# method by Michel Oliveira. * 2013/04/30 * www.joshcellsoftwares.com You may need to use these libraries on your project: System.Diagnostics; System.Net; System.IO; GPL License. */ private static void DownloadAndInstallRegFile(string UriStr) { using (WebClient wbClient = new WebClient()) //Creating a new WebClient object in memory. { string TempRegPth = Path.GetTempFileName() + ".reg"; //Define the temporary file for the downloaded file. { Console.WriteLine("Downloading the registry file online..."); wbClient.DownloadFile(UriStr, TempRegPth); //Download the file to a temp path created above. } Process pStart = new Process(); //Create a new Process object in memory. { Console.WriteLine("Applying the registry changes..."); { pStart.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //Set the WindowStyle to hidden for no prompt at the start pStart.StartInfo.FileName = "REGEDIT.EXE"; //The RegEdit Windows tool for silently apply the reg change. pStart.StartInfo.Arguments = "/S " + @"""" + TempRegPth + @""""; /*The arguments for the RegEdit tool. /S is the silent switch, * @"""" is the quotes for no errors at the app run action, * TempRegPth is the var with the temp downloaded file.*/ pStart.Start(); //Start the RegEdit tool. pStart.WaitForExit(); //Wait for the RegEdit finish. } Console.WriteLine("Cleaning the temp file..."); { if (File.Exists(TempRegPth)) //Check if the temp downloaded file is present. File.Delete(TempRegPth); //Delete the temp file. } } Console.WriteLine("Done! Press any key to exit from this application."); Console.ReadKey(); //Pause the console application. } } Usage: Code: DownloadAndInstallRegFile("http://www.mynewwebsite.com/regfile/registryfile.reg"); //Your online file inside the quotes.
For it, you need to check the server response with this method that I have coded: Code: /* * UriServerIsUp C# method by Michel Oliveira. * 2013/05/01 * www.joshcellsoftwares.com You may need to use these libraries on your project: System.Net; GPL License. */ private static bool UriServerIsUp(string UriStr) { try //Try to do the check without errors. { if (UriStr.ToUpper().StartsWith("FTP://")) //Check if the website procol are FTP. { FtpWebRequest fWebRequest = (FtpWebRequest)WebRequest.Create(UriStr); //Create a request using the Uri string received by the method. fWebRequest.Timeout = 10000; //Set the response timeout to 10 seconds. FtpWebResponse fWebResponse = (FtpWebResponse)fWebRequest.GetResponse(); //Get the server response. if (fWebResponse.StatusCode == FtpStatusCode.OpeningData) //Get the server response code. { return true; //Return true if the response was 'OpeningData'. } else return false; //Return false if the response was not 'OpeningData'. } else //If is not FTP, check as HTTP protocol. { HttpWebRequest hWebRequest = (HttpWebRequest)WebRequest.Create(UriStr); //Create a request using the Uri string received by the method. hWebRequest.Timeout = 10000; //Set the response timeout to 10 seconds. HttpWebResponse hWebResponse = (HttpWebResponse)hWebRequest.GetResponse(); //Get the server response. if (hWebResponse.StatusCode == HttpStatusCode.OK) //Get the server response code. { return true; //Return true if the response was 'OK'. } else return false; //Return false if the response was not 'OK'. } } catch { return false; } //Return false if the there is an error with the request method. } Usage to check multiple websites using the 'UriServerIsUp' and 'DownloadAndInstallRegFile' methods: Code: foreach (string ServerUriString in new object[] { "http://myfirstwebsite.com/regfile.reg", "ftp://ftp.mynewftp.com/regfile.reg", "http://mythserver.com/regfile.reg" }) //Make a simple forearch to check if the servers is working. { if (UriServerIsUp(ServerUriString)) //Check if the UriString has a valid status code. { DownloadAndInstallRegFile(ServerUriString); //Download and Install the registry file. break; //Break the procedure one time that all the operation was completed successfully. } }
? - Please learn about C# a bit more and try to do the things yourself. Will be good and you will learn some basic things instead of always ask for the full code around your development. Tip: You will need to use the Task Scheduler if your app needs of elevation around UAC activated systems.