Guest Jim Posted November 13, 2007 Posted November 13, 2007 Using Windows XP or Win 2003 Server. Is there a way to make a batch file that will create a new folder with the date? For example, if it were this easy...., MKDIR %DATE% would make a directory 11-13-2007 Thanks.
Guest j9 Posted November 13, 2007 Posted November 13, 2007 Re: Making a directory with a date? Take a visit to http://blog.209software.com/2004/10/dos-batch-file-fun-creating.html . This will show you how to make dated directories of all sorts... "Jim" <stopspam@redmond.com> wrote in message news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... > Using Windows XP or Win 2003 Server. > Is there a way to make a batch file that will create a new folder with the > date? > > For example, if it were this easy...., > MKDIR %DATE% would make a directory 11-13-2007 > > Thanks. > >
Guest Pegasus \(MVP\) Posted November 13, 2007 Posted November 13, 2007 Re: Making a directory with a date? Unfortunately the author of this page got things somewhat confused. He wrote that the command should look like so in a batch file: echo md %%date:~-4,4%%\%%date:~-10,2%%\%%date:~-7,2%% whereas in "DOS" it should look like so: echo md %date:~-4,4%\%date:~-10,2%\%date:~-7,2% There are two problems here: a) There is no DOS under Windows, only the Command Prompt. b) The first command is wrong. The second command is correct, both in a batch file and in a Command Prompt. You could also use this syntax, giving you a somewhat different result: echo md "%date:/=%" "j9" <j9@1aprop.com> wrote in message news:fhcpuj$nfc$2@news.al.sw.ericsson.se... > Take a visit to > http://blog.209software.com/2004/10/dos-batch-file-fun-creating.html . > This > will show you how to make dated directories of all sorts... > > > "Jim" <stopspam@redmond.com> wrote in message > news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... >> Using Windows XP or Win 2003 Server. >> Is there a way to make a batch file that will create a new folder with >> the >> date? >> >> For example, if it were this easy...., >> MKDIR %DATE% would make a directory 11-13-2007 >> >> Thanks. >> >> > >
Guest David Webb Posted November 14, 2007 Posted November 14, 2007 Re: Making a directory with a date? I use the following script within CMD files in Win2K, WinXP, and Vista to create folders named in the mmddyyyy format: for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set mdate=%%A%%B%%C md %mdate% I am not the author of this script...all I know is that it works. "Jim" <stopspam@redmond.com> wrote in message news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... > Using Windows XP or Win 2003 Server. > Is there a way to make a batch file that will create a new folder with the > date? > > For example, if it were this easy...., > MKDIR %DATE% would make a directory 11-13-2007 > > Thanks. > >
Guest Jim Posted November 15, 2007 Posted November 15, 2007 Re: Making a directory with a date? Is this the entire script? It doesn't seem to run. Thanks. "David Webb" <dwebb211@earthling.net> wrote in message news:eKYtK7qJIHA.4592@TK2MSFTNGP02.phx.gbl... >I use the following script within CMD files in Win2K, WinXP, and Vista to >create > folders named in the mmddyyyy format: > > for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set mdate=%%A%%B%%C > md %mdate% > > I am not the author of this script...all I know is that it works. > > "Jim" <stopspam@redmond.com> wrote in message > news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... >> Using Windows XP or Win 2003 Server. >> Is there a way to make a batch file that will create a new folder with >> the >> date? >> >> For example, if it were this easy...., >> MKDIR %DATE% would make a directory 11-13-2007 >> >> Thanks. >> >> > >
Guest Pegasus \(MVP\) Posted November 15, 2007 Posted November 15, 2007 Re: Making a directory with a date? You must place both lines into a batch file, then run the batch file. If you still have a proble, post your version of the batch file here and quote all error messages. "It does not seem to run" does not tell us a great deal. "Jim" <stopspam@redmond.com> wrote in message news:OLXu4f5JIHA.1620@TK2MSFTNGP03.phx.gbl... > Is this the entire script? It doesn't seem to run. > > Thanks. > "David Webb" <dwebb211@earthling.net> wrote in message > news:eKYtK7qJIHA.4592@TK2MSFTNGP02.phx.gbl... >>I use the following script within CMD files in Win2K, WinXP, and Vista to >>create >> folders named in the mmddyyyy format: >> >> for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set mdate=%%A%%B%%C >> md %mdate% >> >> I am not the author of this script...all I know is that it works. >> >> "Jim" <stopspam@redmond.com> wrote in message >> news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... >>> Using Windows XP or Win 2003 Server. >>> Is there a way to make a batch file that will create a new folder with >>> the >>> date? >>> >>> For example, if it were this easy...., >>> MKDIR %DATE% would make a directory 11-13-2007 >>> >>> Thanks. >>> >>> >> >> > >
Guest David Webb Posted November 15, 2007 Posted November 15, 2007 Re: Making a directory with a date? Yes, that's all there is to it. To create the command file, create a new text file on your top level folder, open it and copy the script contents then paste them into the body of this new file and then save (using save-as) the file as "CreateDateFolder.cmd", with the quotes. You should then have a New Document.txt and a CreateDateFolder.cmd in your folder. You can delete the TXT file. If you prefer a batch file, use the BAT file extension instead of CMD. "Jim" <stopspam@redmond.com> wrote in message news:OLXu4f5JIHA.1620@TK2MSFTNGP03.phx.gbl... > Is this the entire script? It doesn't seem to run. > > Thanks. > "David Webb" <dwebb211@earthling.net> wrote in message > news:eKYtK7qJIHA.4592@TK2MSFTNGP02.phx.gbl... > >I use the following script within CMD files in Win2K, WinXP, and Vista to > >create > > folders named in the mmddyyyy format: > > > > for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set mdate=%%A%%B%%C > > md %mdate% > > > > I am not the author of this script...all I know is that it works. > > > > "Jim" <stopspam@redmond.com> wrote in message > > news:uoOTawhJIHA.3848@TK2MSFTNGP05.phx.gbl... > >> Using Windows XP or Win 2003 Server. > >> Is there a way to make a batch file that will create a new folder with > >> the > >> date? > >> > >> For example, if it were this easy...., > >> MKDIR %DATE% would make a directory 11-13-2007 > >> > >> Thanks. > >> > >> > > > > > >
Recommended Posts