I have a folder with a hundred mouse cursor sets, each set has an .INF
file that when right clicked and "Install" is clicked and pressing yes for running as admin the set gets added to the Mouse Properties in settings.
I now install them one by one.
int i = 0;
foreach (FileInfo fi in new DirectoryInfo(@"C:\Users\xyz\Dropbox\all2\BestCursors\").GetFiles("*.*", SearchOption.AllDirectories))
{
if (fi.Extension == ".inf")
{
i++;
//InstallHinfSection(IntPtr.Zero, IntPtr.Zero, fi.FullName, 0);
//System.Diagnostics.Process.Start("cmd.exe", "drvload "+ fi.FullName.Replace(@"\\",@"\"));
var process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/c C:\\Windows\\System32\\InfDefaultInstall.exe " + fi.FullName.Replace(@"\\", @"\"); // where driverPath is path of .inf file
process.Start();
process.WaitForExit();
process.Dispose();
}
}
MessageBox.Show(i.ToString());
And include subfolders too.
I want all the mouse sets inside that directory which is on the hard drive to be added to Mouse Properties in Windows 10 settings.