Discussion:
Win98 DOS name a file with the date.
(too old to reply)
Homer Wilson Smith
2022-10-06 06:44:50 UTC
Permalink
Running Win98 4.10.2222 DOS 5.x or 6.x batch scripts

Need to write a file or directory with the date.

echo %date% does not work as it does in future windows.

Is there a batch script command that will do this for me?

Thanks Homer W Smith (Lightlink CEO.)
--
------------------------------------------------------------------------
Homer Wilson Smith Clean Air, Clear Water, Art Matrix - Lightlink
(607) 277-0959 A Green Earth, and Peace, Internet, Ithaca NY
***@lightlink.com Is that too much to ask? http://www.lightlink.com
Robert Roland
2022-10-06 12:27:48 UTC
Permalink
On Thu, 6 Oct 2022 02:44:50 -0400 (EDT), Homer Wilson Smith
Post by Homer Wilson Smith
Running Win98 4.10.2222 DOS 5.x or 6.x batch scripts
Need to write a file or directory with the date.
echo %date% does not work as it does in future windows.
Is there a batch script command that will do this for me?
If I remember correctly, Win98 did come with VBscript. It only works
in Windows mode, though.

Could that be an option?
--
RoRo
Auric__
2022-10-06 18:11:39 UTC
Permalink
Post by Homer Wilson Smith
Running Win98 4.10.2222 DOS 5.x or 6.x batch scripts
Need to write a file or directory with the date.
echo %date% does not work as it does in future windows.
Is there a batch script command that will do this for me?
If it needs to be DOS-compatible, QBasic is an option. (Robert's suggestion
of VBscript won't work under DOS.) Save this to a file called something like
"MDDATE.BAS":

'---begin---
'create directory using today's date as the name
ON ERROR GOTO ender
x$ = DATE$
'y$ is the created directory name in YYYYMMDD format
' year month day
y$ = RIGHT$(x$, 4) + LEFT$(x$, 2) + MID$(x$, 4, 2)
MKDIR y$
ender:
SYSTEM
'---end---

...and save this to something like "MFDATE.BAS":

'---begin---
'create file using today's date as the name
ON ERROR GOTO ender
RANDOMIZE TIMER
x$ = DATE$
'y$ is the created file name in YYYYMMDD format
'change ".txt" to whatever you want
' year month day
y$ = RIGHT$(x$, 4) + LEFT$(x$, 2) + MID$(x$, 4, 2) + ".txt"
z$ = LTRIM$(STR$(INT(RND * 100000000)))
'this nonsense needed because qbasic lacks functionality
SHELL "dir /b " + y$ + ">" + z$ + ".tmp"
OPEN z$ + ".tmp" FOR INPUT AS 1
IF LOF(1) < 1 THEN
'file does not exist; create
OPEN y$ FOR BINARY AS 2
END IF

ender:
ON ERROR GOTO ender2
CLOSE
KILL z$ + ".tmp"
ender2:
SYSTEM
'---end---

Then call the appropriate script at the point in your batch that you need to
create your file:

QBASIC /RUN MFDATE.BAS

...or directory:

QBASIC /RUN MDDATE.BAS
--
When life shuts a door, open it back up.
That's how doors work.
Then shut it again.
JJ
2022-10-06 22:19:59 UTC
Permalink
Post by Homer Wilson Smith
Running Win98 4.10.2222 DOS 5.x or 6.x batch scripts
Need to write a file or directory with the date.
echo %date% does not work as it does in future windows.
Is there a batch script command that will do this for me?
Thanks Homer W Smith (Lightlink CEO.)
The %DATE% variable is an internal variable which is provided by CMD.EXE.
CMD.EXE does not exist in Windows 9x/ME. It only exist in NT based Windows,
and it can't run under Windows 9x/ME.

For Windows 9x/ME, without downloading additional software, the alternative
method is to use Windows Script Host (WSH) with either VBScript or JScript.

With additional software download, my recommendation is to use the open
source 4DOS (formerly a JPSoft's proprietary software). 4DOS is a
replacement for COMMAND.COM and has CMD capabilities (and more). It's 99%
compatible with CMD.EXE and COMMAND.COM.

https://www.4dos.info/
Klaus Meinhard
2022-10-07 07:25:02 UTC
Permalink
Post by JJ
With additional software download, my recommendation is to use the open
source 4DOS (formerly a JPSoft's proprietary software). 4DOS is a
replacement for COMMAND.COM and has CMD capabilities (and more). It's 99%
compatible with CMD.EXE and COMMAND.COM.
https://www.4dos.info/
.. which has the TOUCH command to change file and directory timestamps.
--
Mit freundlichen Grüßen,

* Klaus Meinhard *
Klaus Meinhard
2022-10-07 07:36:35 UTC
Permalink
Am 07.10.2022 um 09:25 schrieb Klaus Meinhard:

.. and it might be funny to compare my (mostly) 1-line 4DOS solutions
to Timo's Batfaq list today:

<https://www.4dos.info/4batfaq.htm>

Even today, JP Software's Take Command, the successor to 4NT and 4DOS,
is way ahead of Microsofts CMD and Powershell. There's a free version
called TCC/LE on theit website.
--
Mit freundlichen Grüßen,

* Klaus Meinhard *
Herbert Kleebauer
2022-10-09 11:20:50 UTC
Permalink
Post by Homer Wilson Smith
Running Win98 4.10.2222 DOS 5.x or 6.x batch scripts
Need to write a file or directory with the date.
echo %date% does not work as it does in future windows.
Is there a batch script command that will do this for me?
Thanks Homer W Smith (Lightlink CEO.)
:::::::::::::::::::::::::::::::::::::::::::::
echo set date=%%2 >call._1_
dir call._1_ |find "_1_" >_2_.bat
ren call._1_ _1_.bat
call _2_.bat
del _1_.bat
del _2_.bat
echo %date%
:::::::::::::::::::::::::::::::::::::::::::::

In NT+ this works only if you use the /-n in the dir command:
dir /-n call._1_ |find "_1_" >_2_.bat


Or a more flexible version (works only in DOS or 32 bit Windows):

@echo off
echo ***@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>d_t.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>d_t.com
echo LisqMz`***@wKuur`***@w?ogBgGG}G?j_egoNOG?w?`gBLksqgG`w?WgBgG>>d_t.com
echo G}G?R_MgoNMy?***@W?s?W?@zAB`LrFuBLyt~vuco{@LuKooD?BFHqrIcP>>d_t.com
echo _sdDxb1T??=?rILO_sdDqx1T??=?rILO_sdDnl1T??=?rILO_sdD`c1T??>>d_t.com
echo =?rILO_sdDgg1T??=?rILO_sdDll1T??=?rILO_sdDrr1T??=??IL?0xxx>>d_t.com

d_t.com>d_t.bat
call d_t.bat
del d_t.com
del d_t.bat

echo century: %_cy%
echo year: %_yr%
echo month: %_mo%
echo day: %_da%
echo hour: %_hh%
echo minute: %_mm%
echo second: %_ss%

Loading...