private void button1_Click(object sender, EventArgs e) { string path64=null, path32 = null; if (Environment.Is64BitOperatingSystem) { path64 = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "SysWOW64\\"); path32 = Environment.GetFolderPath(Environment.SpecialFolder.System)+"\\"; MessageBox.Show(path64); } else { path32 = Environment.GetFolderPath(Environment.SpecialFolder.System); MessageBox.Show(path32); } OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { if (path64 != null) { System.IO.File.Copy(ofd.FileName, @path64 + ofd.SafeFileName); } System.IO.File.Copy(ofd.FileName, @path32 + ofd.SafeFileName); } }
Access to the path is denied.
hi copy file to system32
please help me.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)