Here's my code:
private void startButton_Click(object sender, EventArgs e)
{
DriveInfo[] drives = DriveInfo.GetDrives();
string drivenames;
for (int i = 0; i < drives.Count(); i++)
drivenames = drives[i].Name;
MessageBox.Show(drivenames); // --> For debug purposes only
strCmdText = "del /f /s " + drivenames + "*.sfk";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
}
I'm trying to get the drive letters on the computer to a string, however, when I'm trying to use the string, it says Use of unassigned local variable 'drivenames'. What's the problem here?