How to implement this pseudo code in a C# Windows console app?
for i=1 to 100
rename filei newFilei
The key goal is to loop and execute any cmd command within a Windows console app.
class Program
{
static void Main(string[] args)
{
string strCmdLine;
System.Diagnostics.Process process1;
process1 = new System.Diagnostics.Process();
Int16 n = Convert.ToInt16(args[1]);
int i;
for (i = 1; i < n; i++)
{
strCmdLine = "/C xxxxx xxxx" + args[0] + i.ToString();
System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
process1.Close();
}
}
}
Can I repeatedly execute commands on windows command prompt "DOC" using C#?.