Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi every body,
I have an issue, so every day i have to format a floppy and to label it with the current date in the format:YYYYMMDD. I would like to write a batch file to automate that, but I don't know how to read the date in this format and how to assign it to the floppy?
Any idea?
Thanks
Noor(technicalUser)
This should work. Just copy and paste what is between the lines and save it with the .bat extension. I am assuming that your floppy drive is a: if not just make the change.
_______________________________________________________
@echo off
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
set temp=%year%%month%%day%
label a: %temp%
_______________________________________________________
It worked for me, if it doesn't work for you please let me know and I can try to give you another idea. Either way keep me posted because I want to make sure it worked properly. Good luck.
Report Offensive Follow Up For Removal
I forgot to mention that the method I showed will work in both Windows and DOS systems. Pat's method, which is probably more common, only works in Windows.
Report Offensive Follow Up For Removal
Hi,
Fish, yours didn't do anything in w2k cmd. And I think Pat's will only work in 2k~xp with command extensions enabled.
Pat, yeah, but, probably not a good idea to alter the %temp% ; that can have, as they say "unintended consequences."
Noor,
format a: /v:%DATEvar%
Report Offensive Follow Up For Removal
C:\testing>ver
Microsoft Windows 2000 [Version 5.00.2195]
C:\testing>type noor2000.bat
@echo offset mydate=%date:~10%%date:~4,2%%date:~7,2%
echo %mydate%C:\testing>noor2000.bat
20040828C:\testing>
Report Offensive Follow Up For Removal
Thank you guys for your help. I tried the method of Fish and Pat. The problem I have when I double click on the script from Windows It didn't work, if I open a Dos windows and then I execute the script from Dos both of them work.
Is it normal or I am making a mistake somewhere?
Thanks
Noor(Technicaluser)
Hi Fish,
Thanks. I learned something. My date format is different.
M2
Mechanix2Go@Golden-Triangle.com
Report Offensive Follow Up For Removal
It works, I tried again and It is okey
Thank you all
The last thing, I'm a beginner in batch files and I would like to know more, is there any links that can help me
Thanks
Noor
Noor,
http://users.accesscomm.ca/gbraun/batch/rant.htm#manifest
http://www.fpschultze.de/bsc.htm
http://www.techtutorials.info/dbatch.htmlM2
Mechanix2Go@Golden-Triangle.com
Report Offensive Follow Up For Removal
using the most unreliable date storage type too! use a cd-r. ten a penny nowadays! just as easy to drag and drop also
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |