System.Diagnostics.Process.Start("restart", "-r -t 05");
Question #2: Can someone help me edit the code below I wish to make this make code create the folders more than once. What I mean is, at the moment, I am using this code on the press of "OK". Once I press "OK" it creates the folders, but if I press "OK" again, it doesn't create anymore folders, the problem is because the folders are already created and it can't over-write. Is there a way to make it create like "TEST1-1" or continue with the number last used
for (int i = 0; i < 5; i++)
{
System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Test" + i.ToString());
}

Two Questions
NBaig
int times=0;
buttonOK_click(...,...)
{
for (int i = 0; i < 5; i++)
{
System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Test" +times.ToString()+ i.Tostring());
}
times++;
}
hope that help you
DongMT, VietNam
jeskey
BRAD.Marsh
or just use the current Date/Time to create the folders again, the date/time being the values to use to set the folder name...without having to do a for loop :-)
not sure I quite follow, can you explain further restart what
vtortola
IN your first question you are probably refering to computer Restart! Right See Here:
http://www.pinvoke.net/search.aspx search=ShutDown&namespace=[All]
Best Regards,
Ivo6070
int n = 0, counter = 0;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) ;
while(counter < 5)
{
string path = Path.Combine(folderPath, "Test" + n++) ;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
counter++;
}
}
JK
Brandon Tucker
using System.IO;