1

I create a test.bat file , edit , write DATE and save it.

when i run the bat it show current date then ask for new date , to skip this step i should press enter .

I want to skip entering new date or make it auto press enter .

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112

1 Answers1

1

Windows 98, really?!

You can do it like this:

echo 2019-01-02|date

The 2019-01-02 part should be the same when you manually input the date.
So if the prompt let's you input mm-dd-yy, you should change that to 01-02-19 like date.

For automatically Enter to date, do this:

echo.|date

If you are not setting a new date, but just output the current date,
then(not work in Win98):

date /T
Til
  • 5,150
  • 13
  • 26
  • 34
  • `date /T` is almost certainly what they're looking for – Adam Smith Jan 01 '19 at 17:27
  • quite sure, `date` *hasn't* the `/t` switch in DOS (Win98). I think, there isn't even the `%date%` or `%time%`variables. – Stephan Jan 01 '19 at 20:41
  • when i use date /t , i receive invalid date enter new date (MM-DD-YY) so idk if it's working or not , using %date% i receive nothing – M.Abd El-Raouf Jan 02 '19 at 06:25
  • can i compare the date ? @AdamSmith – M.Abd El-Raouf Jan 02 '19 at 06:28
  • 1
    Comparing? In DOS? I guess it's nearly impossible (or *maybe* with a *lot* of ugly code). Whatever you want to do, you really should use a programming language (Isn't there QBASIC with Win98?) – Stephan Jan 02 '19 at 08:33
  • 1
    Yes it's possible after search i could do it but without space or current date Code SET DATE1="Wed 01-02-2019" ECHO. %DATE1% SET DATE2="Wed 01-02-2019" ECHO. %DATE2% IF %DATE1%==%DATE2% ECHO DATE OKEY IF NOT %DATE1%==%DATE2% ECHO DATE NOT OEKY @Stephan – M.Abd El-Raouf Jan 02 '19 at 09:05
  • 1
    ah - check, if they are the same. Yes, of course. Sorry, most people that ask "compare dates" actually want the difference between two dates. – Stephan Jan 02 '19 at 15:44
  • i just want to check if they are the same but i could not do it If statement in windows 98 uses string ( i can not use space ) only and i can not use DATE ( current date ) after == should i go for QBASIC ? @Stephan – M.Abd El-Raouf Jan 03 '19 at 07:54
  • The "days of DOS" are long ago for me, so I might be wrong, but `if "a b"=="a b" ...`might work – Stephan Jan 03 '19 at 13:22