Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Could you please tell me whats wrong with this batch file ... it doesnt accept the variable (Najib) though its identified...I want it to create a directory by the year and then get into it and create another folder with the month.
This is the script...
(Note: i have a utility that recognizes the cut command since i have no idea how to do it in DOS)#@echo off
Set ToDay=%3
Set Nael=Date /T | cut -c 5-6
Set Najib=Date /T | cut -c 11-15
If not "%ToDay%"=="" GoTo EXEC
For /F "Tokens=2 Delims= " %%a in ('Date /T') Do Set Today=%%a
:EXEC
pauseif not exist c:\batch_files\ammar\%Najib% GoTo CREATES
For /F "Tokens=1-4 Delims=/ " %%a in ('Date /T') Do @echo md %%d > mdyear.bat
call mdyear.bat
del c:\batch_files\ammar\mdyear.bat
:CREATES
pauseFor /F "Tokens=1-4 Delims=/ " %%a in ('Date /T') Do @echo cd %%d > cdyear.bat
call cdyear.bat
del C:\batch_files\ammar\cdyear.batif not exist c:\batch_files\ammar\%Najib%\%Nael% GoTo CREATE
For /F "Tokens=1-4 Delims=/ " %%a in ('Date /T') Do @echo md %%b > c:\batch_files\ammar\%Najib%\mdmo.bat
call c:\batch_files\ammar\%Najib%\mdmo.bat
del c:\batch_files\ammar\%Najib%\mdmo.bat
:CREATESet ToDay=
thanks for your cooperation.
Aladimi

Well,
For starters, this:
#@echo off
won't turn off echo.
Next, it would help to know what "cut" is doing.
And this:
For /F "Tokens=1-4 Delims=/
won't do much in DOS.
M2If at first you don't succeed, you're about average.

Hi Najib
I take it from your code that your in the wrong forum, maybe you should move to the Programming forum, if you want to use Win2000 command prompt as this is for DOS stanalone and not anything that runs from a command prompt in Windows.
From your code I think your just creating a directory for the Year and one inside it for
the month, and then moving to the month directory.
I do not see why you need the Today variable at all to do this.
Some people do not like people who answer any thing in this forum that is not Stand ALone DOS.

RA,
AFAIK, DOS does not use 'for /f' or tokens.
M2If at first you don't succeed, you're about average.

Thanks M2GO but from the "dtech10" response I figured it was not worth bothering about.
DO NOT BAN THE MESSENGER

![]() |
![]() |
![]() |

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