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; }