Hi all
Thanks for all your help so far.
I am looking to force user to re-enter the yyyymmdd.txt file if input is wrong:
Set objFS=CreateObject("Scripting.FileSystemObject")
WScript.Echo "Enter log file date (YYYYMMDD.txt):"
Do While Not WScript.StdIn.AtEndOfLine
strFile = strFile & WScript.StdIn.Read(1)
Loop
s = Split(strFile,".")
yr = Mid(s(0),1,4)
mth = Mid(s(0),5,2)
dy = Mid(s(0),7,2)
If (IsDate(yr&"/"&mth&"/"&dy) <> 0) AND s(UBound(s)) = "txt" Then
WScript.Echo "Valid date and file extension"
WScript.Echo yr&"/"&mth&"/"&dy&".txt"
Else
WScript.Echo "Invalid date and/or file extension"
WScript.Echo "Enter log file date (YYYYMMDD.txt):"
Do While Not WScript.StdIn.AtEndOfLine
strFile = strFile & WScript.StdIn.Read(1)
Loop
End if
Is it a Do until loop? I'm not sure how to go about this one. I haven't programmed in this for a while!
Also, when I want to pass this variable out to another batch program, is it just something like:
wshshell.run "C:\test.bat " yr&"/"&mth&"/"&dy&".txt" ??
Thanks,
Laura