c#将文件复制到某个文件夹内winform文件复制

时间:2022-03-17 04:03:27
try
{
//系统盘
string nl = Environment.NewLine;
string query = "%SystemRoot%";
string str = Environment.ExpandEnvironmentVariables(query);
string str32Path = str + @"\System32\crypto.dll"; var filePath64 = @"key/32dll/crypto.dll"; //验证系统盘system32与是否有dll,有则跳过,无则复制 if (!File.Exists(str32Path))
{
File.Copy(filePath32, str32Path);
} return true;
}
catch (Exception ex)
{
MessageBox.Show("导入dll到系统盘失败,错误原因为:"+ex.Message);
return false;
}