This is the example, a shortcut was installed to this code
:
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[vbs].TimeStamp() [including files].vbs.pvcs 1.0 29 Jun 2014 12:51:24 USER "Dennis" $
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'--- Init -------------------------------------------------------------------
dim oFS : set oFS = CreateObject("Scripting.FileSystemObject")
dim oShell : set oShell = CreateObject("WScript.Shell")
dim FileName : FileName = GetEnv("WINDIR") & "\win.ini"
'--- Test functions ---------------------------------------------------------
wscript.echo FileName
wscript.echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
wscript.echo "NOW() : " & TimeStamp( now() )
dim oFile : set oFile = oFS.GetFile(FileName)
wscript.echo "WIN.INI: " & TimeStampFile(oFile)
set oFile = Nothing
set oFS = Nothing
set oShell = Nothing
'============================================================================
function TimeStamp(ByVal TimeObject) 'NOTE: These timestamps can't be used in filenames as is
'============================================================================
on error resume next
dim TS : TS = ""
TS = TS & Year(TimeObject) & "/" & Pad0(Month(TimeObject),2) & "/" & Pad0(Day(TimeObject), 2) & " "
TS = TS & Pad0(hour(TimeObject),2) & ":" & Pad0(Minute(TimeObject),2) & ":" & Pad0(second(TimeObject), 2) & " "
TS = TS & "(" & ucase(WeekDayName(WeekDay(TimeObject), true)) & ")"
TimeStamp = TS
end function
'============================================================================
function TimeStampFile(ByVal oFile)
'============================================================================
on error resume next
TimeStampFile = TimeStamp( oFile.DateLastModified )
end function
'============================================================================
function Pad0(ByVal TheNumber, ByVal TheLength) 'Never truncates
'============================================================================
dim Lng: Lng = len(TheNumber)
if Lng >= TheLength then
Pad0 = TheNumber
else
Pad0 = string(TheLength-Lng, "0") & TheNumber
end if
end function
'============================================================================
function GetEnv(EnvName)
'============================================================================
dim Try
Try = "%" & EnvName & "%"
GetEnv = oShell.ExpandEnvironmentStrings(Try)
if GetEnv = Try then
GetEnv = ""
end if
end function