[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: Date variables in Xy III -- different solution
- Subject: Re: Date variables in Xy III -- different solution
- From: "Robert Holmgren" holmgren@xxxxxxxx
- Date: Thu, 23 Oct 2003 02:00:05 -0400
** Reply to message from Patricia M Godfrey on Wed, 22 Oct
2003 10:37:07 -0400
Patricia:
On reflection, it seems a bit of overkill to use XyWrite to
obtain today's date in a desired format! Why not just use WSH
(Windows Script Host)? It's free, it works, every Win32 machine
has it, so... You could execute the *entire operation* with WSH...
But, to port my XyWrite script to WSH exactly, you'd need two
files (only) on your floppy -- COPY.BAT and MAKEFILE.VBS
If you need it, grab the documentation for WSH at:
http://download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe
COPY.BAT
-----------------------
@echo off
cscript.exe A:\MAKEFILE.VBS //nologo
if not exist A:\BACKUP.BAT echo Error creating A:\BACKUP.BAT
if not exist A:\BACKUP.BAT goto exit
call A:\BACKUP.BAT
:exit
-----------------------
MAKEFILE.VBS:
-----------------------
Dim d,o,s
set o=CreateObject("Scripting.FileSystemObject")
d=Date
s=left(d,InStr(d,"/")-1)
if len(s)=1 then
s="0"&s
end if
s=right(d,4)&s
d=mid(d,InStr(d,"/")+1,InStrRev(d,"/")-InStr(d,"/")-1)
if len(d)=1 then
d="0"&d
end if
s=s&d
'
' Result variable s = Todays Date in YYYYMMDD format
'
set d=o.CreateTextFile("A:\BACKUP.BAT",True,False)
d.WriteLine "@echo off"
d.WriteLine "d:"
d.WriteLine "if not exist d:\"&s&" mkdir d:\"&s
d.WriteLine "chdir d:\"&s
'
' ADD YOUR OTHER BACKUP.BAT COMMANDS HERE!
'
d.Close
WScript.Quit(0)
-----------------------
-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------