MS DOS Set Time

I'm writing a script set_time.sql
the sets a time variable by hosting to dos.

The variable displays the current time the first time the script is called from SQL>@set_time
but when I executed the script again,
the variable stays the same.

My question is how to refresh (clear) the variable
so each time the script is called it displays the new time?

host Set HHMISS=%TIME%
host echo %hhmiss%
revxprtsAsked:
Who is Participating?
 
jdeclueConnect With a Mentor Commented:
Create a text file on d:\time.cmd

Put this in the text file:

@Echo off
Set HHMISS=
Set HHMISS=%TIME%
echo %hhmiss%

then call

host time.cmd

0
 
jdeclueCommented:
do a

host Set HHMISS=
host Set HHMISS=%TIME%
host echo %hhmiss%

This should clear it each time, first.

J
0
 
revxprtsAuthor Commented:
I tried that already--the time did not change.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jdeclueCommented:
ok just a sec
0
 
jdeclueCommented:
THis is odd... it is working flawlessly for me. What kind of machine are you running on NT/2000/2003?

J
0
 
revxprtsAuthor Commented:
I'm on a Windows 2000 machine, partitioned into C: and D: drives.

=========
set_time.sql
=========
host Set HHMISS=
host echo %hhmiss%

host Set HHMISS=%TIME%
host echo %hhmiss%

=========
=========
D:\> dir
set_time.sql

D:\> sqlplus /nolog
D:\> connect system/passwd
D:\> @set_time

-- time stays the same
0
 
jdeclueCommented:
what happens whe you go to a command prompt and do it manually, are they the same time?

set time=
set time=%TIME%
echo %TIME%

set time=
set time=%TIME%
echo %TIME%
0
 
revxprtsAuthor Commented:
It works fine from the command prompt.
0
 
jdeclueCommented:
the sqlplus is not holding the environment between commands. Can you put this in cmd file and call it?

J
0
 
revxprtsAuthor Commented:
I don't understand
0
 
jdeclueCommented:
So, that worked?

J
0
 
revxprtsAuthor Commented:
You ROCK!
0
 
jdeclueCommented:
Thank you sir ;)

J
0
All Courses

From novice to tech pro — start learning today.