newTime="05:40:00"
newDate=Date+1
Dim oShell
Set oShell=CreateObject("WScript.Shell")
oShell.run "cmd /k date" &CStr(" "&newDate)&"& exit"
oShell.run "cmd /k time" &CStr(" "&newTime)&"& exit"
set oShell=nothing
currentDateTime=now
msgbox currentDateTime
newDate=Date+1
Dim oShell
Set oShell=CreateObject("WScript.Shell")
oShell.run "cmd /k date" &CStr(" "&newDate)&"& exit"
oShell.run "cmd /k time" &CStr(" "&newTime)&"& exit"
set oShell=nothing
currentDateTime=now
msgbox currentDateTime
Here -
" cmd/K is one of the switches avaliable with the cmd.exe"
For Example:
/C Switch : This switch loads a session of ‘cmd.exe’ into
memory, executes the command specified after /C and
terminates the cmd session.
/K Switch : This creates a new command session and
executes the date command, the session is not terminated
after completion of the command.
No comments:
Post a Comment