Home > Software engineering >  [what] how to write a loop in the batch to create scripts folder?
[what] how to write a loop in the batch to create scripts folder?

Time:10-07

I know that creating folders is md & lt; Folder name & gt;
I also know that cycle is used for
Now I want to create 366 folder, the folder name (date) (month) (year), respectively: 20161231
20160101,,,,Every day corresponds to a folder,
This batch should be how to write?

CodePudding user response:

Fyi:
 # include & lt; Afxdisp. H> 
#include
#include
Int main (int arg c, TCHAR * argv []) {
COleDateTime t;
COleDateTimeSpan ts;
Cstrings s, FMT;
Int nYear.
Int nMonth;
Int nDay;
Int nHour;
Int nMin;
Int nSec.
Int lDays;
Int nHours.
Int nMins;
Int nSecs;
Int I, N;
//initialize the MFC and the print and the error on failure
if (! AfxWinInit (: : GetModuleHandle (NULL), NULL, : : GetCommandLine (), 0)) {
Printf (" Fatal Error: MFC initialization failed \ n ");
return 1;
}
If (argc<13) {
Usage: printf (" % s sYYYY sMM sDD SHH sMM SSS pDD PHH PMM PSS n {SQL | YYYY | YY} \ n ", argv [0]).
Return 2;
}
If (stricmp (argv [12], "SQL")==0) FMT="% % Y - m - H: % d % % m: % S".
Else if (stricmp (argv [12], "YYYY")==0) FMT="% % m % d % Y H % m % S".
Else if (stricmp (argv [12], "YY")==0) FMT="% % m % d % y H % m % S".
The else {
Usage: printf (" % s sYYYY sMM sDD SHH sMM SSS pDD PHH PMM PSS n {SQL | YYYY | YY} \ n ", argv [0]).
Return 3;
}
NYear=atoi (argv [1]);
NMonth=atoi (argv [2]);
NDay=atoi (argv [3]);
NHour=atoi (argv [4]);
NMin=atoi (argv [5]);
NSec=atoi (argv [6]);
LDays=atoi (argv [7]);
NHours=atoi (argv [8]);
NMins=atoi (argv [9]);
NSecs=atoi (argv [10]);
N=atoi (argv [11]);
If (N<=0) {
Usage: printf (" % s sYYYY sMM sDD SHH sMM SSS pDD PHH PMM PSS n {SQL | YYYY | YY} \ n ", argv [0]).
The return of 4;
}
T=COleDateTime (nYear, nMonth nDay, nHour, nMin, nSec);
Ts=COleDateTimeSpan (lDays nHours, nMins, nSecs);
For (I=1; i<=N; I++) {
S=t.F ormat (FMT);
08 printf (" % d % s \ n ", I, s);
T=t + ts;
}
return 0;
}

CodePudding user response:

Batch of a for loop,
  • Related