are batch file writing different in windows xp and dos 7.1

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
flyhigh427
Posts: 7
Joined: 07 Mar 2010 09:14

are batch file writing different in windows xp and dos 7.1

#1 Post by flyhigh427 » 23 Jun 2010 00:43

when i run this bat file in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors
anyone know why?
thanks


Code: Select all

@echo off



:start
cls
echo Input password:

IF %DATE:~0,3%==Mon goto mond
IF %DATE:~0,3%==Tue goto tues
IF %DATE:~0,3%==Wed goto wedd
IF %DATE:~0,3%==Thu goto thur
IF %DATE:~0,3%==Fri goto frid
IF %DATE:~0,3%==Sat goto sate
IF %DATE:~0,3%==Sun goto sund



amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: are batch file writing different in windows xp and dos 7

#2 Post by amel27 » 23 Jun 2010 03:26

DOS not support environment variables DATE and TIME, only NT
this code work for me, DATE format: "Current date is Wed 06-23-2010"

Code: Select all

@echo on

echo.|date|find /i "sat"|if not errorlevel 1 >nul goto sate
echo.|date|find /i "sun"|if not errorlevel 1 >nul goto sund
echo.|date|find /i "mon"|if not errorlevel 1 >nul goto mond
echo.|date|find /i "tue"|if not errorlevel 1 >nul goto tues
echo.|date|find /i "wed"|if not errorlevel 1 >nul goto wedd
echo.|date|find /i "thu"|if not errorlevel 1 >nul goto thur
goto frid

Post Reply