Computing.Net > Forums > Disk Operating System > a variable cant be identified.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

a variable cant be identified.

Reply to Message Icon

Name: Najib (by Nael_Najib)
Date: April 3, 2005 at 11:35:47 Pacific
OS: Windows 2000 professional
CPU/Ram: 512MB
Comment:

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
pause

if 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
pause

For /F "Tokens=1-4 Delims=/ " %%a in ('Date /T') Do @echo cd %%d > cdyear.bat
call cdyear.bat
del C:\batch_files\ammar\cdyear.bat

if 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
:CREATE

Set ToDay=


thanks for your cooperation.


Aladimi



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 3, 2005 at 12:02:03 Pacific
Reply:

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.


M2

If at first you don't succeed, you're about average.


0

Response Number 2
Name: rogerashley
Date: April 3, 2005 at 13:26:13 Pacific
Reply:

M2GO why does it not work in DOS Standalone ??

DO NOT BAN THE MESSENGER


0

Response Number 3
Name: dtech10
Date: April 4, 2005 at 09:31:28 Pacific
Reply:

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.


0

Response Number 4
Name: Mechanix2Go
Date: April 4, 2005 at 09:54:56 Pacific
Reply:

RA,

AFAIK, DOS does not use 'for /f' or tokens.


M2

If at first you don't succeed, you're about average.


0

Response Number 5
Name: rogerashley
Date: April 4, 2005 at 11:54:17 Pacific
Reply:

Thanks M2GO but from the "dtech10" response I figured it was not worth bothering about.

DO NOT BAN THE MESSENGER


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: a variable cant be identified.

Redirecting text file to a variable? www.computing.net/answers/dos/redirecting-text-file-to-a-variable/3566.html

Need Leading Zeroes in a Variable. www.computing.net/answers/dos/need-leading-zeroes-in-a-variable/13612.html

copy a file to a variable www.computing.net/answers/dos/copy-a-file-to-a-variable/12678.html